summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-22 00:19:52 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-22 00:19:52 +0000
commitc1ed20cfbab3fb124125e2292b2c16f6ae00ed8d (patch)
tree5c922ece01b9af456956225b6c7921919472198a /clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
parent465184ae10e9ab0532cfe043d8a6b84d95c28b7f (diff)
downloadbcm5719-llvm-c1ed20cfbab3fb124125e2292b2c16f6ae00ed8d.tar.gz
bcm5719-llvm-c1ed20cfbab3fb124125e2292b2c16f6ae00ed8d.zip
Update const_cast semantics for rvalue references. Add tests for
reinterpret_cast and const_cast using rvalue references. llvm-svn: 124007
Diffstat (limited to 'clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp')
-rw-r--r--clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp17
1 files changed, 17 insertions, 0 deletions
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
new file mode 100644
index 00000000000..d46488107ba
--- /dev/null
+++ b/clang/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// The result of the expression const_cast<T>(v) is of type T. If T is
+// an lvalue reference to object type, the result is an lvalue; if T
+// is an rvalue reference to object type, the result is an xvalue;.
+
+unsigned int f(int);
+
+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*>());
+}
OpenPOWER on IntegriCloud