This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC 4.5.0 Reports invalid warning


This is the code.

------------------------------

#define PointerA struct a *

void f( PointerA );

typedef struct a * PA;
struct a { int x; };

void f( PA a )
{
}

---------------------------------

This is the output

 warning: 'struct a' declared inside parameter list
 warning: its scope is only this definition or declaration, which is
probably not what you want
error: conflicting types for 'f'
 note: previous declaration of 'f' was here


--------------------------------

This is valid C code by every other compiler.

If there is already a thread about this, or a bug about it, I didn't
find it searching this lsit or the bugs database.

If I move even the 'typedef struct a *PA' above the first function,
then 'struct a' is apparently defined, even if it is not.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]