mirror of
https://github.com/golang/go.git
synced 2024-09-22 10:58:58 +00:00
put toplevel & check back and add test
R=ken OCL=17307 CL=17307
This commit is contained in:
parent
2e4b8d94cd
commit
493a9d2f42
@ -754,6 +754,8 @@ uexpr:
|
||||
}
|
||||
| '&' uexpr
|
||||
{
|
||||
if($2->op == OCONV && !func)
|
||||
yyerror("& of composite literal at top level");
|
||||
$$ = nod(OADDR, $2, N);
|
||||
}
|
||||
| '+' uexpr
|
||||
@ -1179,11 +1181,13 @@ xfndcl:
|
||||
{
|
||||
maxarg = 0;
|
||||
stksize = 0;
|
||||
func++;
|
||||
} fndcl fnbody
|
||||
{
|
||||
$$ = $3;
|
||||
$$->nbody = $4;
|
||||
funcbody($$);
|
||||
func--;
|
||||
}
|
||||
|
||||
fndcl:
|
||||
|
9
test/addr.go
Normal file
9
test/addr.go
Normal file
@ -0,0 +1,9 @@
|
||||
// errchk $G $D/$F.go
|
||||
|
||||
// Copyright 2009 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 main
|
||||
|
||||
var a = &[]int{1,2}; // ERROR "composite"
|
Loading…
Reference in New Issue
Block a user