https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Prior to DR 616 the expression (true ? WrapB().b : WrapD().d) was a prvalue of
type B, created by copying the B (or slicing the D when the condition is
false). As an rvalue, it wasn't evaluated. That's true pre-N3055 and
post-N3055.

DR 616 changed WrapB().b to be an xvalue, and the result of the expression is
B&& in C++1 (and const B& in C++98 I guess).

In C++98 the const B& is an lvalue, and in C++11 the B&& is an xvalue which is
a glvalue. Either way, it's correct to treat it as a glvalue of polymorphic
type and evaluate it.

So this change is not caused by N3055. And I think G++ is correct for both
C++98 and C++11. So INVALID.

Reply via email to