error about & at top level until it is safe

R=ken
OCL=17241
CL=17241
This commit is contained in:
Russ Cox 2008-10-15 17:09:42 -07:00
parent 1bf38484d1
commit 7cd173a4f8
2 changed files with 6 additions and 0 deletions

View File

@ -468,6 +468,8 @@ EXTERN int32 thunk;
EXTERN int exporting;
EXTERN int func;
/*
* y.tab.c
*/

View File

@ -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: