From: Ian Lance Taylor Date: Thu, 16 Oct 2014 19:55:28 +0000 (+0000) Subject: compiler: Method names must be non-blank. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=299874d5226450fc4f7277b45e40bcfc961385dd;p=gcc.git compiler: Method names must be non-blank. Fixes issue 8078. From-SVN: r216347 --- diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 09369e020f6..b97ada19c84 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -1253,6 +1253,8 @@ Parse::method_spec(Typed_identifier_list* methods) if (this->advance_token()->is_op(OPERATOR_LPAREN)) { // This is a MethodName. + if (name == "_") + error_at(this->location(), "methods must have a unique non-blank name"); name = this->gogo_->pack_hidden_name(name, is_exported); Type* type = this->signature(NULL, location); if (type == NULL) diff --git a/gcc/testsuite/go.test/test/interface/explicit.go b/gcc/testsuite/go.test/test/interface/explicit.go index 36fa1a4224f..b10d02f2485 100644 --- a/gcc/testsuite/go.test/test/interface/explicit.go +++ b/gcc/testsuite/go.test/test/interface/explicit.go @@ -83,12 +83,12 @@ var m4 = M(jj) // ERROR "invalid|wrong type for M method" type B1 interface { - _() + _() // ERROR "methods must have a unique non-blank name" } type B2 interface { M() - _() + _() // ERROR "methods must have a unique non-blank name" } type T2 struct{} diff --git a/gcc/testsuite/go.test/test/interface/fail.go b/gcc/testsuite/go.test/test/interface/fail.go index 81eb6cb3c15..d40a1513832 100644 --- a/gcc/testsuite/go.test/test/interface/fail.go +++ b/gcc/testsuite/go.test/test/interface/fail.go @@ -14,7 +14,6 @@ type I interface { func main() { shouldPanic(p1) - shouldPanic(p2) } func p1() { @@ -30,19 +29,6 @@ type S struct{} func (s *S) _() {} -type B interface { - _() -} - -func p2() { - var s *S - var b B - var e interface{} - e = s - b = e.(B) - _ = b -} - func shouldPanic(f func()) { defer func() { if recover() == nil {