diff options
author | Robert Griesemer <gri@golang.org> | 2010-07-29 10:54:03 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2010-07-29 10:54:03 -0700 |
commit | 85b686bf6dc379bfccdc3a1890f9c923791740ea (patch) | |
tree | 2c1d2ca665d0480f9f873df3cd66bdbbdf691ea3 /test | |
parent | 277f3623f79f0f92ecdb6acc7dfc5a957d811f6c (diff) | |
download | go-85b686bf6dc379bfccdc3a1890f9c923791740ea.tar.gz |
bug299: parenthesized receiver types/anonymous fields are illegal
R=r
CC=golang-dev
http://codereview.appspot.com/1846051
Diffstat (limited to 'test')
-rw-r--r-- | test/bugs/bug299.go | 27 | ||||
-rw-r--r-- | test/golden.out | 9 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/bugs/bug299.go b/test/bugs/bug299.go new file mode 100644 index 000000000..d455540c6 --- /dev/null +++ b/test/bugs/bug299.go @@ -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" diff --git a/test/golden.out b/test/golden.out index 49bca4b87..25dbc914b 100644 --- a/test/golden.out +++ b/test/golden.out @@ -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 } +================================================== |