https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91212
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Happens with a class too:
struct T { int i; };
struct X {
X(T&) { } // #1
X(const T&) { __builtin_abort (); } // #2
};
X
fn ()
{
T buf;
return buf;
}
int
main()
{
X c = fn ();
}
is it actually a bug though, not just a consequence of Core 1579? We treat
'buf' as an rvalue and you can't bind an rvalue to a non-const lvalue ref, so
#2 is chosen.
