diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/CXX/expr/expr.post/expr.const.cast | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/CXX/expr/expr.post/expr.const.cast')
-rw-r--r-- | test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp index 76ea96f..f4c0f1a 100644 --- a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp +++ b/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 { |