summaryrefslogtreecommitdiff
path: root/clang/test/CXX/expr/expr.cast/p4.cpp
blob: 907e008724420bbe5a40f3ca51f59b5bfe522f64 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %clang_cc1 -ast-dump %s | FileCheck %s

struct A { int x; };
struct B { int y; };
struct C : A, B { };

// CHECK: casting_away_constness
void casting_away_constness(const B &b, const C &c, const B *bp, const C *cp) {
  // CHECK: DerivedToBase (B)
  // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'c'
  (void)(B&)c;
  // CHECK: BaseToDerived (B)
  // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'b'
  (void)(C&)b;
  // CHECK: DerivedToBase (B)
  // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'cp'
  (void)(B*)cp;
  // CHECK: BaseToDerived (B)
  // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'bp'
  (void)(C*)bp;
  // CHECK: ReturnStmt
  return;
}