aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2008-12-03 10:41:43 -0800
committerRobert Griesemer <gri@golang.org>2008-12-03 10:41:43 -0800
commit4d76e8e142094cee071310dcfb98fd10527edfbc (patch)
tree082df0b844959645f3c1f4d71a31ac89b0360902
parentc8a66a98ffe74a2a9899dc05bdd169ad842df5e2 (diff)
downloadgo-4d76e8e142094cee071310dcfb98fd10527edfbc.tar.xz
- bug: empty switches don't compile
R=rsc DELTA=32 (28 added, 3 deleted, 1 changed) OCL=20301 CL=20340
-rw-r--r--test/bugs/bug128.go23
-rw-r--r--test/golden.out14
2 files changed, 33 insertions, 4 deletions
diff --git a/test/bugs/bug128.go b/test/bugs/bug128.go
new file mode 100644
index 0000000000..3fd647c004
--- /dev/null
+++ b/test/bugs/bug128.go
@@ -0,0 +1,23 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should compile
+
+// Copyright 2009 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
+func main() {
+ switch {
+ // empty switch is allowed according to syntax
+ // unclear why it shouldn't be allowed
+ }
+ switch tag := 0; tag {
+ // empty switch is allowed according to syntax
+ // unclear why it shouldn't be allowed
+ }
+}
+
+/*
+uetli:~/Source/go1/test/bugs gri$ 6g bug127.go
+bug127.go:5: switch statement must have case labels
+bug127.go:9: switch statement must have case labels
+*/
diff --git a/test/golden.out b/test/golden.out
index fe10981df5..619cb1492d 100644
--- a/test/golden.out
+++ b/test/golden.out
@@ -11,10 +11,11 @@ errchk: ./convlit.go: unmatched error messages:
==================================================
./convlit.go:8: cannot convert non-integer constant to int
./convlit.go:11: overflow converting constant to int
-./convlit.go:12: overflow in float constant
+./convlit.go:12: overflow converting constant to float
./convlit.go:8: cannot convert non-integer constant to int
./convlit.go:9: cannot convert non-integer constant to int
./convlit.go:11: overflow converting constant to int
+./convlit.go:12: overflow converting constant to float
==================================================
=========== ./helloworld.go
@@ -150,9 +151,6 @@ panic PC=xxx
BUG: should not fail
=========== bugs/bug120.go
-Bad float64 const: 1e23+8.388608e6 want 1.0000000000000001e+23 got 1e+23
- want exact: 100000000000000008388608
- got exact: 99999999999999991611392
Bad float64 const: 1e23+1 want 1.0000000000000001e+23 got 1e+23
want exact: 100000000000000008388608
got exact: 99999999999999991611392
@@ -176,6 +174,14 @@ BUG: errchk: command succeeded unexpectedly: 6g bugs/bug125.go
=========== bugs/bug126.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug126.go
+=========== bugs/bug127.go
+BUG: errchk: command succeeded unexpectedly: 6g bugs/bug127.go
+
+=========== bugs/bug128.go
+bugs/bug128.go:5: switch statement must have case labels
+bugs/bug128.go:9: switch statement must have case labels
+BUG: should compile
+
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: overflow converting constant to uint