aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/ast-print.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/ast-print.cpp')
-rw-r--r--test/SemaCXX/ast-print.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/SemaCXX/ast-print.cpp b/test/SemaCXX/ast-print.cpp
new file mode 100644
index 0000000000..44b34aa12c
--- /dev/null
+++ b/test/SemaCXX/ast-print.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -ast-print %s | FileCheck %s
+
+// CHECK: r;
+// CHECK-NEXT: (r->method());
+struct MyClass
+{
+ void method() {}
+};
+
+struct Reference
+{
+ MyClass* object;
+ MyClass* operator ->() { return object; }
+};
+
+int main()
+{
+ Reference r;
+ (r->method());
+}
+
+// CHECK: if (int a = 1)
+// CHECK: while (int a = 1)
+// CHECK: switch (int a = 1)
+
+void f()
+{
+ if (int a = 1) { }
+ while (int a = 1) { }
+ switch (int a = 1) { }
+}
+