// labelname ':' stmt
if labelOk {
// If we have a labelname, it was parsed by operand
- // (calling p.name()) and given an ONAME, ONONAME, OTYPE, or OPACK node.
+ // (calling p.name()) and given an ONAME, ONONAME, OTYPE, OPACK, or OLITERAL node.
switch lhs.Op {
- case ONAME, ONONAME, OTYPE, OPACK:
+ case ONAME, ONONAME, OTYPE, OPACK, OLITERAL:
lhs = newname(lhs.Sym)
default:
p.syntax_error("expecting semicolon or newline or }")
--- /dev/null
+// run
+
+// Copyright 2015 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.
+
+// Verify that a label name matching a constant name
+// is permitted.
+
+package main
+
+const labelname = 1
+
+func main() {
+ goto labelname
+labelname:
+}