bad code silently compiled by egcs

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Wed Mar 31 23:54:00 GMT 1999


> The following code compiles without a warning:
> 1. data_t should not be visible in B
> 2. B's constructor calls an A constructor which is not defined. 

Please compile with -pedantic to get a compiler that is supposed to
reject all non-conforming code. With that option, I get a number of
errors in your code (see below).

Regards,
Martin

mira% g++ -o a -pedantic a.cc
a.cc:24: parse error before `const'
a.cc:24: missing ';' before right brace
a.cc: In instantiation of `B<double>':
a.cc:29:   instantiated from here
a.cc:25: warning: base `A<double>' with only non-default constructor
a.cc:25: warning: in class without a constructor
a.cc: In function `int main()':
a.cc:31: no matching function for call to `B<double>::B (double[2])'
a.cc:25: candidates are: B<double>::B(const class B<double> &)
mira% g++ -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.93.11/specs
gcc version egcs-2.93.11 19990311 (gcc2 ss-980929 experimental)



More information about the Gcc-bugs mailing list