diff options
Diffstat (limited to 'test/SemaCXX/rval-references.cpp')
-rw-r--r-- | test/SemaCXX/rval-references.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp index 4c2050494b69..94b09ce2cb2a 100644 --- a/test/SemaCXX/rval-references.cpp +++ b/test/SemaCXX/rval-references.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s typedef int&& irr; typedef irr& ilr_c1; // Collapses to int& @@ -30,11 +30,15 @@ void f() { int &&virr2 = 0; int &&virr3 = virr2; // expected-error {{rvalue reference to type 'int' cannot bind to lvalue of type 'int'}} int i1 = 0; + const double d1 = 0; + const int ci1 = 1; int &&virr4 = i1; // expected-error {{rvalue reference to type 'int' cannot bind to lvalue of type 'int'}} int &&virr5 = ret_irr(); int &&virr6 = static_cast<int&&>(i1); - (void)static_cast<not_int&&>(i1); // expected-error {{types are not compatible}} - + (void)static_cast<not_int &&>(i1); // expected-error {{reference to type 'not_int' could not bind to an lvalue of type 'int'}} + (void)static_cast<int &&>(static_cast<int const&&>(i1)); // expected-error {{cannot cast from rvalue of type 'const int' to rvalue reference type 'int &&'}} + (void)static_cast<int &&>(ci1); // expected-error {{types are not compatible}} + (void)static_cast<int &&>(d1); int i2 = over(i1); not_int ni1 = over(0); int i3 = over(virr2); |