diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.cc | 9 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/fixedbugs/bug340.go | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index c14a10f..af4d052 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -534fb907c821b052dc430330708d7fa555b91fe3 +68b1c7659a6b25d537a4ff3365ab070fa6215b0b The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 286ecc1..23d1647 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -12052,6 +12052,15 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr, ambig2.c_str()); else if (found_pointer_method) go_error_at(location, "method requires a pointer receiver"); + else if (it != NULL && it->is_empty()) + go_error_at(location, + "reference to method %qs in interface with no methods", + Gogo::message_name(name).c_str()); + else if (it == NULL && type->deref()->interface_type() != NULL) + go_error_at(location, + ("reference to method %qs in type that is " + "pointer to interface, not interface"), + Gogo::message_name(name).c_str()); else if (nt == NULL && st == NULL && it == NULL) go_error_at(location, ("reference to field %qs in object which " diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug340.go b/gcc/testsuite/go.test/test/fixedbugs/bug340.go index d996ab6..8c543c9 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/bug340.go +++ b/gcc/testsuite/go.test/test/fixedbugs/bug340.go @@ -1,6 +1,6 @@ // errorcheck -// Copyright 2011 The Go Authors. All rights reserved. +// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -12,6 +12,6 @@ func main() { var x interface{} switch t := x.(type) { case 0: // ERROR "type" - t.x = 1 // ERROR "type interface \{\}|reference to undefined field or method" + t.x = 1 // ERROR "type interface \{\}|reference to undefined field or method|interface with no methods" } } |