diff options
Diffstat (limited to 'test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp')
-rw-r--r-- | test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp index 22892a6..212adc8 100644 --- a/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp +++ b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp @@ -10,7 +10,10 @@ template<typename T> T&& xvalue(); void test_classification(char *ptr) { int (&fr0)(int) = reinterpret_cast<int (&&)(int)>(f); int &&ir0 = reinterpret_cast<int &&>(*ptr); - int &&ir1 = reinterpret_cast<int &&>(0); - int &&ir2 = reinterpret_cast<int &&>('a'); + int &&ir1 = reinterpret_cast<int &&>(0); // expected-error {{rvalue to reference type}} + int &&ir2 = reinterpret_cast<int &&>('a'); // expected-error {{rvalue to reference type}} int &&ir3 = reinterpret_cast<int &&>(xvalue<char>()); + // Per DR1268, reinterpret_cast can convert between lvalues and xvalues. + int &ir4 = reinterpret_cast<int &>(xvalue<char>()); + int &&ir5 = reinterpret_cast<int &&>(*ptr); } |