Commit 7cd173a4 authored by Russ Cox's avatar Russ Cox

error about & at top level until it is safe

R=ken
OCL=17241
CL=17241
parent 1bf38484
...@@ -468,6 +468,8 @@ EXTERN int32 thunk; ...@@ -468,6 +468,8 @@ EXTERN int32 thunk;
EXTERN int exporting; EXTERN int exporting;
EXTERN int func;
/* /*
* y.tab.c * y.tab.c
*/ */
......
...@@ -754,6 +754,8 @@ uexpr: ...@@ -754,6 +754,8 @@ uexpr:
} }
| '&' uexpr | '&' uexpr
{ {
if($2->op == OCONV && !func)
yyerror("& of composite literal at top level");
$$ = nod(OADDR, $2, N); $$ = nod(OADDR, $2, N);
} }
| '+' uexpr | '+' uexpr
...@@ -1179,11 +1181,13 @@ xfndcl: ...@@ -1179,11 +1181,13 @@ xfndcl:
{ {
maxarg = 0; maxarg = 0;
stksize = 0; stksize = 0;
func++;
} fndcl fnbody } fndcl fnbody
{ {
$$ = $3; $$ = $3;
$$->nbody = $4; $$->nbody = $4;
funcbody($$); funcbody($$);
func--;
} }
fndcl: fndcl:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment