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
8f94383a
Commit
8f94383a
authored
Jan 21, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Check for calling value method with dereferenced value.
From-SVN: r183379
parent
98dfd7ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
gcc/go/gofrontend/types.cc
+8
-0
No files found.
gcc/go/gofrontend/types.cc
View file @
8f94383a
...
...
@@ -8605,6 +8605,7 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
// If this is a pointer to a pointer, then it is possible that the
// pointed-to type has methods.
bool
dereferenced
=
false
;
if
(
nt
==
NULL
&&
st
==
NULL
&&
it
==
NULL
...
...
@@ -8617,6 +8618,7 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
return
Expression
::
make_error
(
location
);
nt
=
type
->
points_to
()
->
named_type
();
st
=
type
->
points_to
()
->
struct_type
();
dereferenced
=
true
;
}
bool
receiver_can_be_pointer
=
(
expr
->
type
()
->
points_to
()
!=
NULL
...
...
@@ -8656,6 +8658,12 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
else
go_unreachable
();
go_assert
(
m
!=
NULL
);
if
(
dereferenced
&&
m
->
is_value_method
())
{
error_at
(
location
,
"calling value method requires explicit dereference"
);
return
Expression
::
make_error
(
location
);
}
if
(
!
m
->
is_value_method
()
&&
expr
->
type
()
->
points_to
()
==
NULL
)
expr
=
Expression
::
make_unary
(
OPERATOR_AND
,
expr
,
location
);
ret
=
m
->
bind_method
(
expr
,
location
);
...
...
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