summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim/expr.prim.general/p4-0x.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2011-11-07 03:27:58 +0000
committerDavid Blaikie <dblaikie@gmail.com>2011-11-07 03:27:58 +0000
commitb06c68d320b943c6c1eea1811b61faed5b873c2c (patch)
tree7c7556b0c0f5a1707503be3d61423f1b7366f110 /clang/test/CXX/expr/expr.prim/expr.prim.general/p4-0x.cpp
parenta08acd8588e461df6ad74af3c5bd3ad1cc4149af (diff)
downloadbcm5719-llvm-b06c68d320b943c6c1eea1811b61faed5b873c2c.tar.gz
bcm5719-llvm-b06c68d320b943c6c1eea1811b61faed5b873c2c.zip
Move tests to the appropriate directory to match the spec hierarchy.
llvm-svn: 143906
Diffstat (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.general/p4-0x.cpp')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.general/p4-0x.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.general/p4-0x.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.general/p4-0x.cpp
new file mode 100644
index 00000000000..143ba897ae9
--- /dev/null
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.general/p4-0x.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+struct S {
+ S *p = this; // ok
+ decltype(this) q; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} \
+ expected-error {{C++ requires a type specifier for all declarations}}
+
+ int arr[sizeof(this)]; // expected-error {{invalid use of 'this' outside of a nonstatic member function}}
+ int sz = sizeof(this); // ok
+};
OpenPOWER on IntegriCloud