| 1 |
// PR c++/88103 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct A { |
| 5 |
A (int); |
| 6 |
A&& foo () &&; |
| 7 |
int i; |
| 8 |
}; |
| 9 |
void free (A&&); |
| 10 |
|
| 11 |
void test_xvalue (A a){ |
| 12 |
A&& ref = true ? static_cast<A&&> (a) : static_cast<A&&> (a); |
| 13 |
free (true ? static_cast<A&&> (a) : static_cast<A&&> (a)); |
| 14 |
(true ? static_cast<A&&> (a) : static_cast<A&&> (a)).foo (); |
| 15 |
int&& k = (true ? static_cast<A&&> (a) : static_cast<A&&> (a)).i; |
| 16 |
} |
| 17 |
void test_prvalue (A a){ |
| 18 |
A&& ref = true ? static_cast<A&&> (a) : 1; |
| 19 |
free (true ? static_cast<A&&> (a) : 1); |
| 20 |
(true ? static_cast<A&&> (a) : 1).foo (); |
| 21 |
int&& k = (true ? static_cast<A&&> (a) : 1).i; |
| 22 |
} |