gcc returns: niko.cpp: In function 'int gun()': niko.cpp:7: error: 'A::A(const A&)' is private niko.cpp:20: error: within this context
when compiling: struct A { A() ; int fun() const ; private: A( const A& ) ; } ; int hun( const A& a ) { return a.fun()*4 ; } int gun() { return 4+5*hun(A()) ; } MSVC 2008 and COMEAU compile this program flawlessly. -- Summary: Attempt to copy a temporary object during passing it to a function as a const reference Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dervih at interia dot pl GCC host triplet: Windows XP, x86, gcc 4.2.3 ; Red Hat 2.6, x86, gcc 4.1.2 ; ALL GCC target triplet: Windows XP, x86, gcc 4.2.3 ; Red Hat 2.6, x86, gcc 4.1.2 ; ALL http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36490