bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bison empty union


From: Paul Eggert
Subject: Re: bison empty union
Date: Tue, 03 Jan 2006 22:57:26 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

twlevo <address@hidden> writes:

> /* line 249, parse-gram.y, empty %union {} is not detected currently */
> %union { }
> %%
> prog:
>  ;
> %%
>
> results in a sizeof(YYSTYPE) zero, see generated parser.

A nice test case, but I think Bison's behavior is OK here.  It's not
Bison's job to verify the validity of C code, and the %union contains
C code.  Some C compilers accept empty unions (GCC being one example),
and Bison shouldn't second-guess this.

Solaris 10 /usr/ccs/bin/yacc acts like Bison here, for what it's worth.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]