This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
weird call to copy ctor [2nd try]
- To: egcs-bugs at cygnus dot com
- Subject: weird call to copy ctor [2nd try]
- From: Christian Millour <chris161 at club-internet dot fr>
- Date: Mon, 6 Jul 1998 14:59:04 +0200
// Hi. I haven't seen any response to my original post (06/26/98)
// which has made it to the archive but was edited on the way to
// the point of being totally unreadable (as if sed'ed with the
// command '1,$s/<[^>]*>//g' -- rather puzzling). So, has anyone
// knowledgeable seen this ? is it in the pipe for a fix (fixed
// already :-) ? )
// TIA.
// egcs 1.0.3a
// 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 !?!?
}