[Bug c++/14779] [3.3 Regression] the copy constructor for a templatized class is not used in array initialization unless the constructor was previously referenced

jonathanu at apptechsys dot com gcc-bugzilla@gcc.gnu.org
Thu Apr 1 14:14:00 GMT 2004


------- Additional Comments From jonathanu at apptechsys dot com  2004-04-01 14:14 -------
Here's another variation with no array involved that still exhibits the problem.
In this case, a structure initialization causes the compiler to produce the same
incorrect code. 

------------

extern "C" void abort (); 
 
struct S { 
    S () : self (this) {}         
    S (const S&) : self (this) {}         
    S* self; 
}; 
 
template <typename T> struct X { 
    T t; 
}; 

const X<S> x = { S () }; 
 
int main () 
{ 
  if (x.t.self != &x.t) 
    abort (); 
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14779



More information about the Gcc-bugs mailing list