]> Cypherpunks repositories - gostls13.git/commitdiff
bug299: parenthesized receiver types/anonymous fields are illegal
authorRobert Griesemer <gri@golang.org>
Thu, 29 Jul 2010 17:54:03 +0000 (10:54 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 29 Jul 2010 17:54:03 +0000 (10:54 -0700)
R=r
CC=golang-dev
https://golang.org/cl/1846051

test/bugs/bug299.go [new file with mode: 0644]
test/golden.out

diff --git a/test/bugs/bug299.go b/test/bugs/bug299.go
new file mode 100644 (file)
index 0000000..d455540
--- /dev/null
@@ -0,0 +1,27 @@
+// errchk $G $D/$F.go
+
+// Copyright 2010 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.
+
+package main
+
+type T struct {
+       // accepted by both compilers, legal according to spec
+       x int
+       y (int)
+       int
+       *float
+       // not accepted by both compilers, not legal according to spec
+       (complex)  // ERROR "non-declaration|expected"
+       (*string)  // ERROR "non-declaration|expected"
+       *(bool)    // ERROR "non-declaration|expected"
+}
+
+// accepted by both compilers, legal according to spec
+func (p T) m() {}
+
+// accepted by 6g, not accepted by gccgo, not legal according to spec
+func (p (T)) f() {}   // ERROR "expected"
+func (p *(T)) g() {}  // ERROR "expected"
+func (p (*T)) h() {}  // ERROR "expected"
index 49bca4b874b17eba73c447c88bc23ba74813597b..25dbc914bbd3df7a45ab5f7096f9253efc63cd4a 100644 (file)
@@ -177,3 +177,12 @@ panic PC=xxx
 =========== bugs/bug260.go
 FAIL
 BUG: bug260 failed
+
+=========== bugs/bug299.go
+BUG: errchk: bugs/bug299.go:25: missing expected error: 'expected'
+errchk: bugs/bug299.go:26: missing expected error: 'expected'
+errchk: bugs/bug299.go:27: missing expected error: 'expected'
+errchk: bugs/bug299.go: unmatched error messages:
+==================================================
+bugs/bug299.go:19: syntax error: unexpected }
+==================================================