This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10245: [3.3/3.4 regression] ?: operator requires public copy constructor of return type
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, harri dot pasanen at trema dot com, jean-paul_marinier at hp dot com, nobody at gcc dot gnu dot org, tot at trema dot com
- Date: 27 Mar 2003 17:22:47 -0000
- Subject: Re: c++/10245: [3.3/3.4 regression] ?: operator requires public copy constructor of return type
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, harri dot pasanen at trema dot com, jean-paul_marinier at hp dot com, nobody at gcc dot gnu dot org, tot at trema dot com, gcc-gnats at gcc dot gnu dot org
Old Synopsis: regression in 3.3, C++ ternary operator confuses type lookup
New Synopsis: [3.3/3.4 regression] ?: operator requires public copy constructor of return type
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Mar 27 17:22:47 2003
State-Changed-Why:
Confirmed. This worked in 3.2, but doesn't anymore in 3.3 and
3.4. Here's an extract:
----------------------------
struct X {};
struct Y {
Y ();
operator X () const;
private:
Y (const Y &);
};
void foo() {
X x = (1 ? Y() : Y());
}
------------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void foo()':
x.cc:7: error: `Y::Y(const Y&)' is private
x.cc:12: error: within this context
x.cc:7: error: `Y::Y(const Y&)' is private
x.cc:12: error: within this context
Apparently it wants to make a copy of the return arguments.
Since at least in Standard C++ (not in Gnu C++) ?: returns
an rvalue, I don't think this is necessary.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10245