mirror of
https://github.com/golang/go
synced 2024-11-21 18:04:40 -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:
parent
c72dbaf312
commit
5b62ba14c4
@ -794,7 +794,7 @@ reswitch:
|
|||||||
defaultlit(&n->left, T);
|
defaultlit(&n->left, T);
|
||||||
l = n->left;
|
l = n->left;
|
||||||
if(l->op == OTYPE) {
|
if(l->op == OTYPE) {
|
||||||
if(n->isddd)
|
if(n->isddd || l->type->bound == -100)
|
||||||
yyerror("invalid use of ... in type conversion", l);
|
yyerror("invalid use of ... in type conversion", l);
|
||||||
// pick off before type-checking arguments
|
// pick off before type-checking arguments
|
||||||
ok |= Erv;
|
ok |= Erv;
|
||||||
|
@ -43,4 +43,5 @@ func bad(args ...int) {
|
|||||||
var x int
|
var x int
|
||||||
_ = unsafe.Pointer(&x...) // ERROR "[.][.][.]"
|
_ = unsafe.Pointer(&x...) // ERROR "[.][.][.]"
|
||||||
_ = unsafe.Sizeof(x...) // ERROR "[.][.][.]"
|
_ = unsafe.Sizeof(x...) // ERROR "[.][.][.]"
|
||||||
|
_ = [...]byte("foo") // ERROR "[.][.][.]"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user