This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19112] assignment from function to template fails
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Dec 2004 17:36:57 -0000
- Subject: [Bug c++/19112] assignment from function to template fails
- References: <20041221164037.19112.d.hentrich@gmx.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-12-21 17:36 -------
gcc is correct: the result of getSomething is a temporary. Temporaries can
only be bound to const references, not to non-const ones. Thus, the
constructor
UsePointer(Pointer<TEST> &point)
: m_localCopy(point)
{}
is not a candidate. In order to use the constructor
UsePointer(Pointer<TEST> point)
: m_localCopy(point)
{
}
you need to be able to copy objects of type Pointer<int>, but then you
run into the same problem of not having an appropriate copy constructor
of Pointer that takes a constant reference.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19112