Subject: c++ compilation error with gcc 2.95.2
To: None <tech-toolchain@netbsd.org>
From: Martin Husemann <martin@duskware.de>
List: tech-toolchain
Date: 12/03/2000 00:57:09
I've encountered a strange error when building Mozilla on sparc64 (compiling
with gcc 2.95.2 from gnu/dist/toolchain). I've worked around it in pkgsrc
by adding pkgsrc/www/mozilla/patches/patch-al - but this patch is not correct,
so I'm trying to find the real cause of the problem.
I've "reduced" this to a single (but still large) file (put on ftp.netbsd.org
as ~martin/realy-borked.cpp.gz), which can be compiled with something like
c++ -c realy-borked.cpp
and on sparc64 gives this error:
realy-borked.cpp:8223: ANSI C++ forbids data member `ip_opts' with same name as enclosing class
realy-borked.cpp:10164: cast specifies signature type
realy-borked.cpp:10164: cast specifies signature type
The last two messages are wrong (I think).
In the patch in the mozilla pkg I removed parts of the struct aggregate
initialization, counting on it being set to zero anyway (it's in a static
array).
This make it compile.
In the example, if I remove any of two completely unrelated class declarations
the error vanishes too (just change any of the #if 1 to #if 0). If I reduce
the example significantly, it works too (thats why the file is still so big).
I couldn't test it on gcc 2.95.2 on other ports (but Linux seems to compile
the Mozilla code with gcc 2.95.2 just fine - with their headers).
I can't believe there are MD errors like this in the c++ frontend (and I
don't understand what gcc is trying to say to me here). Can anyone test this
example on gcc 2.95.2 on other ports?
It compiles fine on -current i386 after changing the destructor in class
CToken (removing the size argument).
Any hints appreciated (I'd like to know if this is a mozilla source problem
or toolchain bug - my vote on toolchain bug).
Martin
P.S.: this is an edited version of the preprocessor output on sparc64, thats
where the >32 bit numbers come from.