This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

weird call to copy ctor [2nd try]


// 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 !?!?
}




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]