[Bug c++/15817] Fails to invoke constructor; uses default copy constructor instead
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Fri Jun 4 13:23:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list