gcc/testsuite/g++.dg/cpp0x/rv-cast6.C
raw| 1 | // Test that a prvalue can be used where a glvalue is expected. |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct A { virtual void f(); }; |
| 5 | struct B : A {}; |
| 6 | |
| 7 | auto && a = static_cast<A&&>(B()); |
| 8 | auto && b = reinterpret_cast<A&&>(B()); // { dg-error "prvalue" } |
| 9 | auto && c = dynamic_cast<A&&>(B()); |
| 10 | auto && d = dynamic_cast<B&&>(static_cast<A&&>(B())); |
| 11 | auto && e = const_cast<B&&>(B()); |