[cfe-dev] Semantics for dereferencing incomplete types?
Eli Friedman
eli.friedman at gmail.com
Sun Jan 13 02:19:23 PST 2008
On Jan 12, 2008 11:45 PM, Neil Booth <neil at daikokuya.co.uk> wrote:
> Eli Friedman wrote:-
>
> > Here is another test:
> > void foo3 (void)
> > {
> > void* x = 0;
> > void* y = &*x;
> > }
>
> Correct behaviour there depends on dialect:
>
> neil at duron:~/src/c$ ~/src/cfe/cfe /tmp/bug.c --c90
> "/tmp/bug.c", line 4: error: expression must be an lvalue or a function
> void* y = &*x;
> ^
> "/tmp/bug.c", line 4: warning: variable "y" declared but not used
> void* y = &*x;
> ^
>
> 1 error found compiling "/tmp/bug.c".
> neil at duron:~/src/c$ ~/src/cfe/cfe /tmp/bug.c --c99
> "/tmp/bug.c", line 4: warning: variable "y" declared but not used
> void* y = &*x;
> ^
Right... it's actually a completely different case from the first two
functions because void expressions aren't lvalues.
Wow, the C standard is really confusing.
-Eli
More information about the cfe-dev
mailing list