2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o %t %s
|
2013-07-04 23:22:16 +08:00
|
|
|
// RUN: not grep "_ZN1XaSERK1X" %t
|
2009-08-14 05:09:41 +08:00
|
|
|
|
|
|
|
extern "C" int printf(...);
|
|
|
|
|
2009-08-14 05:38:50 +08:00
|
|
|
struct B {
|
2009-08-14 05:47:21 +08:00
|
|
|
B() : B1(3.14), B2(3.15), auB2(3.16) {}
|
2009-08-14 05:38:50 +08:00
|
|
|
float B1;
|
|
|
|
float B2;
|
|
|
|
void pr() {
|
2009-08-14 05:47:21 +08:00
|
|
|
printf("B1 = %f B2 = %f auB1 = %f\n", B1, B2, auB1);
|
2009-08-14 05:38:50 +08:00
|
|
|
}
|
2009-08-14 05:47:21 +08:00
|
|
|
|
|
|
|
union {
|
|
|
|
float auB1;
|
|
|
|
float auB2;
|
|
|
|
};
|
2009-08-14 05:38:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct M {
|
2009-08-14 05:47:21 +08:00
|
|
|
M() : M1(10), M2(11) , auM1(12) {}
|
2009-08-14 05:38:50 +08:00
|
|
|
int M1;
|
|
|
|
int M2;
|
|
|
|
void pr() {
|
2009-08-14 05:47:21 +08:00
|
|
|
printf("M1 = %d M2 = %d auM1 = %d auM2 = %d\n", M1, M2, auM1, auM2);
|
2009-08-14 05:38:50 +08:00
|
|
|
}
|
2009-08-14 05:47:21 +08:00
|
|
|
union {
|
|
|
|
int auM1;
|
|
|
|
int auM2;
|
|
|
|
};
|
2009-08-14 05:38:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct N : B {
|
|
|
|
N() : N1(20), N2(21) {}
|
|
|
|
int N1;
|
|
|
|
int N2;
|
|
|
|
void pr() {
|
|
|
|
printf("N1 = %d N2 = %d\n", N1, N2);
|
|
|
|
B::pr();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Q {
|
|
|
|
Q() : Q1(30), Q2(31) {}
|
|
|
|
int Q1;
|
|
|
|
int Q2;
|
|
|
|
void pr() {
|
|
|
|
printf("Q1 = %d Q2 = %d\n", Q1, Q2);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct X : M , N {
|
2009-08-14 05:09:41 +08:00
|
|
|
X() : d(0.0), d1(1.1), d2(1.2), d3(1.3) {}
|
|
|
|
double d;
|
|
|
|
double d1;
|
|
|
|
double d2;
|
|
|
|
double d3;
|
|
|
|
void pr() {
|
|
|
|
printf("d = %f d1 = %f d2 = %f d3 = %f\n", d, d1,d2,d3);
|
2009-08-14 05:38:50 +08:00
|
|
|
M::pr(); N::pr();
|
|
|
|
q1.pr(); q2.pr();
|
2009-08-14 05:09:41 +08:00
|
|
|
}
|
2009-08-14 05:38:50 +08:00
|
|
|
|
|
|
|
Q q1, q2;
|
2009-08-14 05:09:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
X srcX;
|
|
|
|
X dstX;
|
|
|
|
X dstY;
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
dstY = dstX = srcX;
|
|
|
|
srcX.pr();
|
|
|
|
dstX.pr();
|
|
|
|
dstY.pr();
|
|
|
|
}
|
|
|
|
|