This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25231] Compiler error for copy constructor with non const input
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Dec 2005 20:53:18 -0000
- Subject: [Bug c++/25231] Compiler error for copy constructor with non const input
- References: <bug-25231-11809@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-12-02 20:53 -------
This is expected and how C++ works.
t1(t1& tr);
is a copy constructor which only takes references which means it only takes
lvalues.
t1 dosomething(const t1& v) const;
That means it returns a variable and calling that function and the result is
not an lvalue so there is no way to bind the return value to a reference.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25231