gcc/testsuite/g++.old-deja/g++.other/cond6.C
raw| 1 | // { dg-do assemble } |
| 2 | // Test that the result of `x ? const E : E' is an E rvalue. |
| 3 | // Contributed by Jason Merrill <[email protected]> |
| 4 | |
| 5 | enum E { a }; |
| 6 | |
| 7 | bool b; |
| 8 | |
| 9 | int main () |
| 10 | { |
| 11 | E e1 = a; |
| 12 | const E &er = e1; |
| 13 | E e2 = b ? er : a; // OK |
| 14 | const E* ep = &(b ? er : a); // { dg-error "" } non-lvalue |
| 15 | } |