]> Cypherpunks repositories - gostls13.git/commitdiff
gc: iota outside const
authorRuss Cox <rsc@golang.org>
Wed, 27 Jul 2011 18:45:27 +0000 (14:45 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 27 Jul 2011 18:45:27 +0000 (14:45 -0400)
Fixes #1662.

R=ken2
CC=golang-dev
https://golang.org/cl/4828045

src/cmd/gc/lex.c
test/fixedbugs/bug362.go [new file with mode: 0644]

index 21ac779a9f9b9e190a4e8ed06864dceaa8ac035a..6845a8ecd655b686bd2cc496072ae5395f51753e 100644 (file)
@@ -218,6 +218,7 @@ main(int argc, char *argv[])
                curio.nlsemi = 0;
 
                block = 1;
+               iota = -1000000;
 
                yyparse();
                if(nsyntaxerrors != 0)
diff --git a/test/fixedbugs/bug362.go b/test/fixedbugs/bug362.go
new file mode 100644 (file)
index 0000000..7912091
--- /dev/null
@@ -0,0 +1,16 @@
+// errchk $G $D/$F.go
+
+// 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.
+
+// issue 1662
+// iota inside var
+
+package main
+
+var (
+       a = iota  // ERROR "undefined: iota"
+       b = iota  // ERROR "undefined: iota"
+       c = iota  // ERROR "undefined: iota"
+)