This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36490] New: Attempt to copy a temporary object during passing it to a function as a const reference
- From: "dervih at interia dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jun 2008 16:43:44 -0000
- Subject: [Bug c++/36490] New: Attempt to copy a temporary object during passing it to a function as a const reference
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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