I looked around to see if a bug was already filed on this and couldn't find one. CWG 1550, passed in Bristol, changes the value category of the result of a conditional operator when one operand is an lvalue and the other is a throw-expression: * The second or the third operand (but not both) is a (possibly parenthesized) throw-expression (15.1); the result is of the type and value category of the other. Here is a test, that should compile in C++: struct X { int i_; bool b_; int& test() {return b_ ? i_ : throw 1;} }; Current behavior is: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int' int& test() {return b_ ? i_ : throw 1;} ~~~^~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~ 1 error generated. I tried clang++. It accepts the code.
This is a dup of bug 64372. *** This bug has been marked as a duplicate of bug 64372 ***