This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/5937: g++ 3.0.2 does not allow return of class constructor
- From: nathan at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, kristof_subryan at filemaker dot com, mike_harris at filemaker dot com, nobody at gcc dot gnu dot org
- Date: 25 Apr 2002 13:46:20 -0000
- Subject: Re: c++/5937: g++ 3.0.2 does not allow return of class constructor
- Reply-to: nathan at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, kristof_subryan at filemaker dot com, mike_harris at filemaker dot com, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: g++ 3.0.2 does not allow return of class constructor
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Thu Apr 25 06:46:18 2002
State-Changed-Why:
Not a bug.
return X(d)
uses the X::X(int) ctor to create a temporary, and then
requires a copy constructor to copy that temporary
into the return slot. See [6.6.3]/2 and [12.2]. Now, we
can (and do) eliminate that temporary, as allowed by
[12.8]/15, but that is an optimization and the copy
ctor must still be accessible.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5937