[comp.lang.c] ?: syntax

torek@elf.ee.lbl.gov (Chris Torek) (04/05/91)

In article <18234@crdgw1.crd.ge.com> volpe@camelback.crd.ge.com
(Christopher R Volpe) writes:
[given	a ? b = 1 : c = 1  or equivalent]
>GCC ... with -ansi [and -pedantic] ... never finds the syntax
>violation.

True, but it does produce a diagnostic, so I think it is doing the
right thing.  It is no surprise that gcc's parser accepts the
expression: gcc uses a single yacc (well, bison) grammar and has
extensions, so it must use some other error for `-ansi -pedantic'
violations that otherwise fit its extensions (as in this case).
I am sure the standard does not require the diagnostic for the
above to be `syntax error'.  `Invalid lvalue in assignment' is
not the best error message, though.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov