]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: Mark use of builtin functions as calls.
authorDaniel Morsing <daniel.morsing@gmail.com>
Mon, 22 Oct 2012 17:14:30 +0000 (19:14 +0200)
committerDaniel Morsing <daniel.morsing@gmail.com>
Mon, 22 Oct 2012 17:14:30 +0000 (19:14 +0200)
Fixes #4097.

R=rsc
CC=golang-dev, gri
https://golang.org/cl/6749059

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

index 2ee468a58ac144e32eede255fe142dfa5b61aad7..cebc2ff8a9262b66f062312486e2aedad54c5dca 100644 (file)
@@ -245,6 +245,12 @@ callrecv(Node *n)
        case OCALLINTER:
        case OCALLFUNC:
        case ORECV:
+       case OCAP:
+       case OLEN:
+       case OCOPY:
+       case ONEW:
+       case OAPPEND:
+       case ODELETE:
                return 1;
        }
 
diff --git a/test/fixedbugs/issue4097.go b/test/fixedbugs/issue4097.go
new file mode 100644 (file)
index 0000000..2c999a8
--- /dev/null
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2012 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 foo
+
+var s [][10]int
+const m = len(s[len(s)-1]) // ERROR "must be constant" 
+