diff options
Diffstat (limited to 'clang/test/CXX/expr')
| -rw-r--r-- | clang/test/CXX/expr/expr.const/p2-0x.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/clang/test/CXX/expr/expr.const/p2-0x.cpp b/clang/test/CXX/expr/expr.const/p2-0x.cpp index 7a43c4541ab..d4afeb8a031 100644 --- a/clang/test/CXX/expr/expr.const/p2-0x.cpp +++ b/clang/test/CXX/expr/expr.const/p2-0x.cpp @@ -322,7 +322,7 @@ namespace LValueToRValue { // constant expression; constexpr volatile S f() { return S(); } static_assert(f().i, ""); // ok! there's no lvalue-to-rvalue conversion here! - static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} + static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} } // DR1312: The proposed wording for this defect has issues, so we ignore this diff --git a/clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp b/clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp index 76ea96fe14a..f4c0f1ae122 100644 --- a/clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp +++ b/clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp @@ -6,14 +6,26 @@ unsigned int f(int); +struct X {}; + template<typename T> T& lvalue(); template<typename T> T&& xvalue(); template<typename T> T prvalue(); -void test_classification(const int *ptr) { - int *ptr0 = const_cast<int *&&>(ptr); - int *ptr1 = const_cast<int *&&>(xvalue<const int*>()); - int *ptr2 = const_cast<int *&&>(prvalue<const int*>()); +void test_classification(const int *ptr, X x) { + int *&&ptr0 = const_cast<int *&&>(ptr); + int *&&ptr1 = const_cast<int *&&>(xvalue<const int*>()); + int *&&ptr2 = const_cast<int *&&>(prvalue<const int*>()); // expected-error {{const_cast from rvalue to reference type 'int *&&'}} + X &&ptr3 = const_cast<X&&>(x); + X &&ptr4 = const_cast<X&&>(xvalue<X>()); + X &&ptr5 = const_cast<X&&>(prvalue<X>()); + + int *&ptr6 = const_cast<int *&>(ptr); + int *&ptr7 = const_cast<int *&>(xvalue<const int*>()); // expected-error {{const_cast from rvalue to reference type 'int *&'}} + int *&ptr8 = const_cast<int *&>(prvalue<const int*>()); // expected-error {{const_cast from rvalue to reference type 'int *&'}} + X &ptr9 = const_cast<X&>(x); + X &ptrA = const_cast<X&>(xvalue<X>()); // expected-error {{const_cast from rvalue to reference type 'X &'}} + X &ptrB = const_cast<X&>(prvalue<X>()); // expected-error {{const_cast from rvalue to reference type 'X &'}} } struct A { |

