1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:50:23 -07:00

gc: disallow ... in type conversions

Fixes #1866.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4548073
This commit is contained in:
Anthony Martin 2011-05-31 15:41:47 -04:00 committed by Russ Cox
parent c72dbaf312
commit 5b62ba14c4
2 changed files with 2 additions and 1 deletions

View 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;

View File

@ -43,4 +43,5 @@ func bad(args ...int) {
var x int
_ = unsafe.Pointer(&x...) // ERROR "[.][.][.]"
_ = unsafe.Sizeof(x...) // ERROR "[.][.][.]"
_ = [...]byte("foo") // ERROR "[.][.][.]"
}