[Bug c++/25231] Compiler error for copy constructor with non const input

2005-12-02 Thread pinskia at gcc dot gnu dot org
--- Comment #3 from pinskia at gcc dot gnu dot org 2005-12-02 21:14 --- (In reply to comment #2) > I really don't think that the reply addresses the question. If a function > returns an object it has to call a copy constructor. This code compiles if the > copy constructor is declared as

[Bug c++/25231] Compiler error for copy constructor with non const input

2005-12-02 Thread richard at rggibbs dot com
--- Comment #2 from richard at rggibbs dot com 2005-12-02 21:11 --- I really don't think that the reply addresses the question. If a function returns an object it has to call a copy constructor. This code compiles if the copy constructor is declared as t1(const t1& tr); but fails if de

[Bug c++/25231] Compiler error for copy constructor with non const input

2005-12-02 Thread pinskia 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 tha