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]

[Bug c++/15817] Fails to invoke constructor; uses default copy constructor instead


------- Additional Comments From bangerth at dealii dot org  2004-06-04 13:23 -------
I'm having a hard time reading through your code (you really need to 
learn to send us small, already reduced testcases!), but maybe it is 
this: if you have code like 
----------------- 
template <typename T> struct A { 
  A (); 
  template <typename U> A (const A<U> &); 
}; 
 
A<int> a; 
A<int> b(a); 
----------------- 
then naively one would expect that the compiler takes the templated 
copy constructor in the construction of b, with U=T=int. However, this 
is not the case: the compiler synthesizes a default copy constructor 
by itself. The rule is that a templated copy constructor is never chosen 
instead of the default copy constructor. You will have to explicitly 
declare the default copy constructor. 
 
Is this the problem here? 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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