Affected subclause: [expr.cond]
Change: A conditional expression with a throw expression as its second or third
operand keeps the type and value category of the other operand
. Effect on original feature: Valid C++ 2011 code that relies on the conversions may behave differently
in this International Standard:
struct S {
int x = 1;
void mf() { x = 2; }
};
int f(bool cond) {
S s;
(cond ? s : throw 0).mf();
return s.x;
}
In C++ 2011,
f(true) returns
1. In this International Standard,
it returns
2.
sizeof(true ? "" : throw 0)
In C++ 2011, the expression yields
sizeof(const char*). In this
International Standard, it yields
sizeof(const char[1]).