aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-08-27 04:12:50 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-08-27 04:12:50 +0000
commit53fa2d27a0275e03696351dc2a178ed12fb9b6ed (patch)
tree5be33cdff35a1aae1b0fb66c5f216c5139fb9c45
parentfadc8afc655851ee2e3973974414f76f526ed87f (diff)
downloadgcc-53fa2d27a0275e03696351dc2a178ed12fb9b6ed.zip
gcc-53fa2d27a0275e03696351dc2a178ed12fb9b6ed.tar.gz
gcc-53fa2d27a0275e03696351dc2a178ed12fb9b6ed.tar.bz2
compiler: Disallow call of *T method using **T variable.
Fixes https://code.google.com/p/go/issues/detail?id=8583. From-SVN: r214560
-rw-r--r--gcc/go/gofrontend/types.cc5
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug371.go6
2 files changed, 6 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index eba224b..395b5e5 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -9453,10 +9453,11 @@ 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())
+ if (dereferenced)
{
error_at(location,
- "calling value method requires explicit dereference");
+ "calling method %qs requires explicit dereference",
+ Gogo::message_name(name).c_str());
return Expression::make_error(location);
}
if (!m->is_value_method() && expr->type()->points_to() == NULL)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug371.go b/gcc/testsuite/go.test/test/fixedbugs/bug371.go
index 6329e96..86c73bf 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/bug371.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug371.go
@@ -8,10 +8,10 @@
package main
-type T struct {}
+type T struct{}
func (t *T) pm() {}
-func (t T) m() {}
+func (t T) m() {}
func main() {
p := &T{}
@@ -20,5 +20,5 @@ func main() {
q := &p
q.m() // ERROR "requires explicit dereference"
- q.pm()
+ q.pm() // ERROR "requires explicit dereference"
}