2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
|
2009-12-10 07:02:17 +08:00
|
|
|
|
|
|
|
// CHECK: example0
|
|
|
|
void example0() {
|
|
|
|
double d = 2.0;
|
|
|
|
// CHECK: double &rd =
|
|
|
|
// CHECK-NEXT: DeclRefExpr
|
|
|
|
double &rd = d;
|
2010-09-05 08:04:01 +08:00
|
|
|
// CHECK: const double &rcd =
|
|
|
|
// CHECK-NEXT: ImplicitCastExpr{{.*}}'const double' <NoOp>
|
2009-12-10 07:02:17 +08:00
|
|
|
const double &rcd = d;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct A { };
|
|
|
|
struct B : A { } b;
|
|
|
|
|
|
|
|
// CHECK: example1
|
|
|
|
void example1() {
|
2010-03-10 19:27:22 +08:00
|
|
|
// CHECK: A &ra =
|
2010-04-25 03:06:50 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)> lvalue
|
2009-12-10 07:02:17 +08:00
|
|
|
A &ra = b;
|
2010-03-10 19:27:22 +08:00
|
|
|
// CHECK: A const &rca =
|
2009-12-10 07:02:17 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
|
2010-04-25 03:06:50 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
|
2009-12-10 07:02:17 +08:00
|
|
|
const A& rca = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern B f();
|
|
|
|
|
|
|
|
struct X {
|
|
|
|
operator B();
|
|
|
|
} x;
|
|
|
|
|
|
|
|
// CHECK: example2
|
|
|
|
void example2() {
|
2010-03-10 19:27:22 +08:00
|
|
|
// CHECK: A const &rca =
|
2009-12-10 07:02:17 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
|
2010-04-25 03:06:50 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
|
2010-03-10 19:27:22 +08:00
|
|
|
// CHECK: CallExpr{{.*}}B
|
2009-12-10 07:02:17 +08:00
|
|
|
const A &rca = f();
|
2010-03-10 19:27:22 +08:00
|
|
|
// CHECK: A const &r =
|
2009-12-10 07:02:17 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
|
2010-04-25 03:06:50 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
|
2009-12-10 07:02:17 +08:00
|
|
|
// CHECK: CXXMemberCallExpr{{.*}}'struct B'
|
|
|
|
const A& r = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: example3
|
|
|
|
void example3() {
|
2010-09-05 08:04:01 +08:00
|
|
|
// CHECK: const double &rcd2 =
|
2009-12-10 07:02:17 +08:00
|
|
|
// CHECK: ImplicitCastExpr{{.*}}<IntegralToFloating>
|
|
|
|
const double& rcd2 = 2;
|
|
|
|
}
|