C++ problems with GNU C extensions
Bernd Schmidt
crux@Pool.Informatik.RWTH-Aachen.DE
Wed May 13 03:41:00 GMT 1998
G++ doesn't handle some GNU C extensions very well. Here are two test
cases.
The first one is a compiler crash.
The second one demonstrates a bogus warning which is very annoying if you
try to compile C++ programs with the string optimizations present in beta
versions of the GNU C library.
Bernd
darkstar:/tmp/x # gcc -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.28/specs
gcc version egcs-2.91.28 19980508 (gcc2 ss-980502 experimental)
darkstar:/tmp/x # cat tst1.cpp
template<int i> int f (void)
{
if (({ 1; }))
return 0;
return 1;
}
void g (void)
{
f<1> ();
}
darkstar:/tmp/x # gcc tst1.cpp
tst1.cpp: In function `int f<1>()':
tst1.cpp:3: Internal compiler error.
tst1.cpp:3: Please submit a full bug report to `egcs-bugs@cygnus.com'.
darkstar:/tmp/x # cat tst3.cpp
class Q
{
char x[256];
public:
virtual ~Q();
operator const char * () { return x; }
};
int main ()
{
Q a;
__builtin_constant_p (a);
}
darkstar:/tmp/x # gcc tst3.cpp -S
tst3.cpp: In function `int main()':
tst3.cpp:13: warning: cannot pass objects of type `Q' through `...'
More information about the Gcc-bugs
mailing list