[cfe-dev] PATCH: Cleanup function redeclaration representations
Neil Booth
neil at daikokuya.co.uk
Thu Apr 24 06:53:48 PDT 2008
Doug Gregor wrote:-
> On Thu, Apr 24, 2008 at 9:45 AM, Neil Booth <neil at daikokuya.co.uk> wrote:
> > However, it's nice to complain about / reject the "x" in things like
> >
> > void foo1 (void) { extern int x(void); }
> > void foo2 (void) { extern double x(void); }
> >
> > $ gcc /tmp/bug.c
> > /tmp/bug.c: In function 'foo2':
> > /tmp/bug.c:2: error: conflicting types for 'x'
> > /tmp/bug.c:1: error: previous declaration of 'x' was here
> >
> > This is undefined behaviour according to the C standard; but there
> > is little value in letting such stuff pass.
>
> Very nice... it would definitely be helpful to diagnose this sort of problem.
Agreed. It's a shame that extern declarations at local scope are
permitted though; it really opens up a huge can of worms with no
satisfactory coding solution (that I found anyway :)); as anyone
trying to implement this stuff properly rapidly discovers :)
Nothing compared to the journeys of C++ though....
Neil.
More information about the cfe-dev
mailing list