weird call to copy ctor
Christian Millour
chris161@club-internet.fr
Fri Jun 26 00:20:00 GMT 1998
// Hi. The following problem was raised recently on the french c++
// newsgroup. Sorry if it has been reported already.
// I have used egcs version 1.0.3
// In the following snippet, the call to f (really f<int>(A<int>) )
// triggers a call to B<int>::B(B<int> const &), which is wrong.
// Only the A<int> part should be copied.
#include <cassert>
template <class T> struct A {};
template <class T>
struct B : public A<T> {
B() {}
B(B const &) { assert(0); }
};
template <class T> void f(A<T>) {}
int main()
{
B<int> b;
f(b); // B<int>::B(B<int> const &) invoked here !?!?
}
More information about the Gcc-bugs
mailing list