diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Import/cxx-casts/Inputs/F.cpp | 12 | ||||
-rw-r--r-- | clang/test/Import/cxx-casts/test.cpp | 21 |
2 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/Import/cxx-casts/Inputs/F.cpp b/clang/test/Import/cxx-casts/Inputs/F.cpp new file mode 100644 index 00000000000..79326a7e4b2 --- /dev/null +++ b/clang/test/Import/cxx-casts/Inputs/F.cpp @@ -0,0 +1,12 @@ +struct A { + virtual ~A() {} +}; +struct B : public A {}; + +void f() { + const A *b = new B(); + const B *c1 = dynamic_cast<const B *>(b); + const B *c2 = static_cast<const B *>(b); + const B *c3 = reinterpret_cast<const B *>(b); + A *c4 = const_cast<A *>(b); +} diff --git a/clang/test/Import/cxx-casts/test.cpp b/clang/test/Import/cxx-casts/test.cpp new file mode 100644 index 00000000000..49215ce81c7 --- /dev/null +++ b/clang/test/Import/cxx-casts/test.cpp @@ -0,0 +1,21 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXDynamicCastExpr +// CHECK-SAME: dynamic_cast +// CHECK-SAME: <Dynamic> + +// CHECK: CXXStaticCastExpr +// CHECK-SAME: static_cast +// CHECK-SAME: <BaseToDerived (A)> + +// CHECK: CXXReinterpretCastExpr +// CHECK-SAME: reinterpret_cast +// CHECK-SAME: <BitCast> + +// CHECK: CXXConstCastExpr +// CHECK-SAME: const_cast +// CHECK-SAME: <NoOp> + +void expr() { + f(); +} |