[ASTImporter] Add test for member pointer types.
authorRaphael Isemann <teemperor@gmail.com>
Thu, 16 Aug 2018 18:22:21 +0000 (18:22 +0000)
committerRaphael Isemann <teemperor@gmail.com>
Thu, 16 Aug 2018 18:22:21 +0000 (18:22 +0000)
Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, martong, cfe-commits

Differential Revision: https://reviews.llvm.org/D50792

llvm-svn: 339919

clang/test/Import/cxx-member-pointers/Inputs/S.cpp [new file with mode: 0644]
clang/test/Import/cxx-member-pointers/test.cpp [new file with mode: 0644]

diff --git a/clang/test/Import/cxx-member-pointers/Inputs/S.cpp b/clang/test/Import/cxx-member-pointers/Inputs/S.cpp
new file mode 100644 (file)
index 0000000..afee60d
--- /dev/null
@@ -0,0 +1,7 @@
+struct S {
+  int i;
+};
+
+int S::*iptr() {
+  return &S::i;
+}
diff --git a/clang/test/Import/cxx-member-pointers/test.cpp b/clang/test/Import/cxx-member-pointers/test.cpp
new file mode 100644 (file)
index 0000000..253c90b
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s
+
+// CHECK: VarDecl
+// CHECK-SAME: int S::*
+// CHECK-NEXT: CallExpr
+// CHECK-NEXT: ImplicitCastExpr
+// CHECK-SAME: int S::*(*)()
+// CHECK-NEXT: DeclRefExpr
+// CHECK-SAME: int S::*()
+
+void expr() {
+  int S::*p = iptr();
+  S s;
+  s.i = 3;
+  int i = s.*p;
+}