This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15817] Fails to invoke constructor; uses default copy constructor instead
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2004 13:23:15 -0000
- Subject: [Bug c++/15817] Fails to invoke constructor; uses default copy constructor instead
- References: <20040604043200.15817.igodard@pacbell.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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