This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
- From: Andrew Pollard <andrewp at andypo dot net>
- To: bangerth at dealii dot org, andrew at andypo dot net, gcc-bugs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Tue, 28 Jan 2003 18:16:44 GMT
- Subject: Re: c++/9440: [3.4 regression] error message about "non-lvalue in unary '&'" when using ?: operator
- References: <20030128154117.8754.qmail@sources.redhat.com>
bangerth@dealii.org replied:
> Confirmed. The problem is the lack of a copy constructor,
> but the message is profoundly unhelpful in detecting this.
I don't think a copy constructor should have anything to do with it.
Doesn't the compiler synthesize a copy constructor if there isn't
one defined?
Anyway, even if I add one, I still get the error...
odd.cxx:
--------------
struct A {
explicit A(int = 0);
A(const A&);
operator int() const;
};
A
bar(bool b, const A& a)
{
return (b ? A() : a);
}
--------------
% g++34 -c odd.cxx
odd.cxx: In function `A bar(bool, const A&)':
odd.cxx:10: error: non-lvalue in unary `&'
Andrew.