egcs-1.1b C++ compile fails with redundant typedefs

Peter.Schauer Peter.Schauer@Regent.E-Technik.TU-Muenchen.DE
Sun Sep 6 15:38:00 GMT 1998


egcs-1.1b reports an error with certain redundant typedefs, if the first
typedef is in a header file and the redundant second typedef is in the
main source file. An example is appended below.

Tracked it down to TYPE_MAIN_VARIANT being different for SIG_TYP_I
(they are the same for SIG_TYP_CP), so comptypes fails and the error message
is produced. I have no idea why they are different though.

PS: I do know that this code is ugly, and the redundant typedefs should
be avoided, but ...

pes@bier_1129$ cat tp2.h
typedef void SIG_FUNC_TYP_I(int);
typedef SIG_FUNC_TYP_I *SIG_TYP_I;
pes@bier_1130$ cat tp2.cc
#include "tp2.h"
typedef void SIG_FUNC_TYP_I(int);
typedef SIG_FUNC_TYP_I *SIG_TYP_I;

typedef void SIG_FUNC_TYP_CP(int);
typedef void SIG_FUNC_TYP_CP(int);
typedef SIG_FUNC_TYP_CP *SIG_TYP_CP;
typedef SIG_FUNC_TYP_CP *SIG_TYP_CP;
pes@bier_1131$ gcc -v
Reading specs from /usr/local/gnu/gcc-e1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
pes@bier_1132$ gcc -c tp2.cc
tp2.cc:3: redefinition of `typedef void (* SIG_TYP_I)(int)'
tp2.h:2: `typedef void (* SIG_TYP_I)(int)' previously declared here

-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de



More information about the Gcc-bugs mailing list