[Bug c++/70610] [6 regression] error: invalid initialization of non-const reference of type
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Apr 10 21:34:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70610
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This general issue about the unconditional lvalue-ness of NON_DEPENDENT_EXPR
existed before my patch for PR c++/21802 though. For example, ere's a test
case that should compile cleanly but doesn't since at least g++ 4.4 (-std=c++98
is required) for basically the same reason:
struct A { };
void operator+ (const A &, A &);
void operator+ (A &, const A &);
void operator+ (const A &, const A &);
template <typename T>
void
foo ()
{
A () + A ();
}
unary_plus.C: In function ‘void foo()’:
unary_plus.C:11:8: error: ambiguous overload for ‘operator+’ (operand types are
‘A’ and ‘A’)
A () + A ();
~~~~~^~~~~~
unary_plus.C:3:6: note: candidate: void operator+(const A&, A&)
void operator+ (const A &, A &);
^~~~~~~~
unary_plus.C:4:6: note: candidate: void operator+(A&, const A&)
void operator+ (A &, const A &);
^~~~~~~~
unary_plus.C:5:6: note: candidate: void operator+(const A&, const A&)
void operator+ (const A &, const A &);
^~~~~~~~
More information about the Gcc-bugs
mailing list