Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
d6218114
Commit
d6218114
authored
Oct 11, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Better error message of unsafe.Offsetof(method value).
From-SVN: r203454
parent
0213a547
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletions
+13
-1
gcc/go/gofrontend/expressions.cc
+13
-1
No files found.
gcc/go/gofrontend/expressions.cc
View file @
d6218114
...
...
@@ -7253,6 +7253,15 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
if
(
this
->
code_
==
BUILTIN_OFFSETOF
)
{
Expression
*
arg
=
this
->
one_arg
();
if
(
arg
->
bound_method_expression
()
!=
NULL
||
arg
->
interface_field_reference_expression
()
!=
NULL
)
{
this
->
report_error
(
_
(
"invalid use of method value as argument "
"of Offsetof"
));
return
this
;
}
Field_reference_expression
*
farg
=
arg
->
field_reference_expression
();
while
(
farg
!=
NULL
)
{
...
...
@@ -7262,7 +7271,8 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
// it must not be reached through pointer indirections.
if
(
farg
->
expr
()
->
deref
()
!=
farg
->
expr
())
{
this
->
report_error
(
_
(
"argument of Offsetof implies indirection of an embedded field"
));
this
->
report_error
(
_
(
"argument of Offsetof implies "
"indirection of an embedded field"
));
return
this
;
}
// Go up until we reach the original base.
...
...
@@ -7672,6 +7682,8 @@ Find_call_expression::expression(Expression** pexpr)
bool
Builtin_call_expression
::
do_is_constant
()
const
{
if
(
this
->
is_error_expression
())
return
true
;
switch
(
this
->
code_
)
{
case
BUILTIN_LEN
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment