]> granicus.if.org Git - clang/commitdiff
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339919 91177308-0d34-0410-b5e6-96231b3b80d8

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

diff --git a/test/Import/cxx-member-pointers/Inputs/S.cpp b/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/test/Import/cxx-member-pointers/test.cpp b/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;
+}