On Fri, 15 Sep 2006, Paul Eggert wrote:

> "Joel E. Denny" <[EMAIL PROTECTED]> writes:
> 
> > shouldn't Bison warn when there's %union or <...> usage in the
> > grammar but a $$ without a type appears in a %destructor/%printer?
> 
> You mean, something like this?
> 
>      %union { char *p; }
>      %token STRING
>      %destructor { free ($$); } STRING

Yes.

> It would make sense to warn about this, yes, though as the C compiler
> will generate a type error for this sort of thing it doesn't sound
> that urgent.

I agree.  I thought of it because Akim proposed that Bison should warn 
when $$ should be used but isn't used in %destructor/%printer.  I felt 
Bison also should warn when $$ shouldn't be used but is used.  This would 
be more consistent with semantic actions, and that should help the user 
not to get confused.

> (I can't think of an example where the C compiler
> wouldn't warn, but perhaps I'm not thinking outside the box
> enough....)

I think there are cases involving void* and C++ overloaded functions, but 
I'm not worried about that so much.


Reply via email to