xref: /llvm-project/clang/test/CXX/expr/expr.cast/p4.cpp (revision 351762cda239e2bb90fb2084e546878fea90ebf6)
158281359SDouglas Gregor // RUN: %clang_cc1 -ast-dump %s | FileCheck %s
258281359SDouglas Gregor 
358281359SDouglas Gregor struct A { int x; };
458281359SDouglas Gregor struct B { int y; };
558281359SDouglas Gregor struct C : A, B { };
658281359SDouglas Gregor 
758281359SDouglas Gregor // CHECK: casting_away_constness
casting_away_constness(const B & b,const C & c,const B * bp,const C * cp)858281359SDouglas Gregor void casting_away_constness(const B &b, const C &c, const B *bp, const C *cp) {
958281359SDouglas Gregor   // CHECK: DerivedToBase (B)
10*351762cdSJohn McCall   // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'c'
1158281359SDouglas Gregor   (void)(B&)c;
1258281359SDouglas Gregor   // CHECK: BaseToDerived (B)
13*351762cdSJohn McCall   // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'b'
1458281359SDouglas Gregor   (void)(C&)b;
1558281359SDouglas Gregor   // CHECK: DerivedToBase (B)
16*351762cdSJohn McCall   // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'cp'
1758281359SDouglas Gregor   (void)(B*)cp;
1858281359SDouglas Gregor   // CHECK: BaseToDerived (B)
19*351762cdSJohn McCall   // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'bp'
2058281359SDouglas Gregor   (void)(C*)bp;
2158281359SDouglas Gregor   // CHECK: ReturnStmt
2258281359SDouglas Gregor   return;
2358281359SDouglas Gregor }
24