[cfe-commits] r50538 - /cfe/trunk/lib/Sema/SemaDecl.cpp
Neil Booth
neil at daikokuya.co.uk
Fri May 2 19:20:26 PDT 2008
Argiris Kirtzidis wrote:-
> Out of curiosity, how is this accepted ?:
>
> void foo (void) { g(); }
> int g;
>
> If you respect scope then you shouldn't report a redeclaration error, is
> this correct ?
Right. But the behaviour is undefined (it violates 6.2.7p2). I think a good
implementation would reject it; GCC does I believe. It is tricky though
because the front-end has to distinguish between something being visible
and something existing even though it can't be seen in the scope stack.
That's why I chose to use it rather than declare it in my example :)
> As a side note, just to make sure it's clear enough, my commit didn't cause
> this behavior on clang, it was already working this way.
> The commit just satisfied an assertion, it didn't make a difference in how
> implicitly defined functions are handled.
I see; sorry I'd assumed this was new.
Neil.
More information about the cfe-commits
mailing list