aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/cxx-this.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/cxx-this.cpp')
-rw-r--r--test/Sema/cxx-this.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Sema/cxx-this.cpp b/test/Sema/cxx-this.cpp
new file mode 100644
index 0000000000..b8bf4b7d3a
--- /dev/null
+++ b/test/Sema/cxx-this.cpp
@@ -0,0 +1,6 @@
+// RUN: clang -fsyntax-only -verify %s
+int x = this; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
+
+void f() {
+ int x = this; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
+}