extern "C" typedefs

Josh MacDonald jmacd@paris.CS.Berkeley.EDU
Wed Oct 21 23:10:00 GMT 1998


This code compiles with every C compiler I've ever used, and 
also compiles with g++ 2.7.2.  I am running:

Reading specs from /usr/local/lib/gcc-lib/i386-unknown-freebsd2.2.7/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)

I may be falling behind in the seemingly perpetual evolution of C++, 
but since this is in an extern "C" scope, it seems that it should
accept it.  It complains:

test.cc:5: use of enum `_X' without previous declaration

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

#ifdef __cplusplus
extern "C" {
#endif

typedef enum _X X;

#ifdef __cplusplus
}
#endif

------------------------------------------------------------------------
-josh



More information about the Gcc-bugs mailing list