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]
Other format: [Raw text]

Re: c++/9987: Failure to call a copy constructor with complex templated member functions.


Synopsis: Failure to call a copy constructor with complex templated member functions.

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Fri Mar  7 14:55:56 2003
State-Changed-Why:
    Not a bug. If you have
      template <class T> class X {
        template <class U> X (const X<U> &);
      }
      X<int> x_int1;
      X<int> x_int2(x_int1);
      X<char> x_char(x_int1);
    then the templated copy constructor is called in the
    initialization of x_char, but _not_ in that of x_int2. For
    the latter, the compiler synthesizes the byte-copy default
    copy constructor. If you want to have a user defined
    copy constructor for the case T==U, then you have to declare
    and implement it. Doing so in your program makes the SegFault
    go away (just checked that).
    
    Regards
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9987


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