]> Cypherpunks repositories - gostls13.git/commitdiff
gc: disallow ... in type conversions
authorAnthony Martin <ality@pbrane.org>
Tue, 31 May 2011 19:41:47 +0000 (15:41 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 31 May 2011 19:41:47 +0000 (15:41 -0400)
Fixes #1866.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4548073

src/cmd/gc/typecheck.c
test/ddd1.go

index 0cf11684dae8ec23e3bde32d2da46a2fa64d6b60..66fc77a97301f5609ddb71c544745e9ca5080e7f 100644 (file)
@@ -794,7 +794,7 @@ reswitch:
                defaultlit(&n->left, T);
                l = n->left;
                if(l->op == OTYPE) {
-                       if(n->isddd)
+                       if(n->isddd || l->type->bound == -100)
                                yyerror("invalid use of ... in type conversion", l);
                        // pick off before type-checking arguments
                        ok |= Erv;
index a0bc73814fd551e256aff9ccb4774607ed76f0e3..96a358e1c01f54bf6146f7e39d9835a8f43f3e86 100644 (file)
@@ -43,4 +43,5 @@ func bad(args ...int) {
        var x int
        _ = unsafe.Pointer(&x...)       // ERROR "[.][.][.]"
        _ = unsafe.Sizeof(x...) // ERROR "[.][.][.]"
+       _ = [...]byte("foo") // ERROR "[.][.][.]"
 }