struct A {
int x;
struct B {
int i;
int j;
} b;
} a1 = { 1, { 2, 3 } };
struct NonAggregate {
#if __cplusplus >= 201103L
#endif
NonAggregate();
#if __cplusplus >= 201103L
#endif
int a, b;
};
NonAggregate non_aggregate_test = { 1, 2 };
#if __cplusplus <= 199711L
#else
#endif
NonAggregate non_aggregate_test2[2] = { { 1, 2 }, { 3, 4 } };
#if __cplusplus <= 199711L
#else
#endif
A a_init = A();
int x[] = { 1, 3, 5 };
int x_sizecheck[(sizeof(x) / sizeof(int)) == 3? 1 : -1];
int x2[] = { };
struct StaticMemberTest {
int i;
static int s;
int *j;
} smt = { 1, &smt.i };
char cv[4] = { 'a', 's', 'd', 'f', 0 };
struct TooFew { int a; char* b; int c; };
TooFew too_few = { 1, "asdf" };
#if __cplusplus <= 199711L
#else
#endif
struct NoDefaultConstructor {
#if __cplusplus <= 199711L
#else
#endif
NoDefaultConstructor(int);
#if __cplusplus <= 199711L
#else
#endif
};
struct TooFewError {
#if __cplusplus <= 199711L
#endif
int a;
NoDefaultConstructor nodef;
#if __cplusplus <= 199711L
#else
#endif
};
TooFewError too_few_okay = { 1, 1 };
TooFewError too_few_error = { 1 };
TooFewError too_few_okay2[2] = { 1, 1 };
#if __cplusplus <= 199711L
#else
#endif
TooFewError too_few_error2[2] = { 1 };
NoDefaultConstructor too_few_error3[3] = { };
struct Empty { };
struct EmptyTest {
Empty s;
int i;
} empty_test = { { }, 3 };
EmptyTest empty_test2 = { 3 };
struct NonEmpty {
int a;
Empty empty;
};
struct NonEmptyTest {
NonEmpty a, b;
} non_empty_test = { { }, { } };
struct HasReference {
int i;
int &j; };
int global_int;
HasReference r1 = { 1, global_int };
HasReference r2 = { 1 } ;
int xs[2][2] = { 3, 1, 4, 2 };
float y[4][3] = { { 1 }, { 2 }, { 3 }, { 4 } };
float y2[4][3] = { { 1, 3, 5 }, { 2, 4, 6 }, { 3, 5, 7 } };
float same_as_y2[4][3] = { 1, 3, 5, 2, 4, 6, 3, 5, 7 };
struct A2 {
int i;
operator int *();
};
struct B2 {
A2 a1, a2;
int *z;
};
struct C2 {
operator A2();
};
struct D2 {
operator int();
};
A2 a2;
C2 c2;
D2 d2;
B2 b2 = { 4, a2, a2 };
B2 b2_2 = { 4, d2, 0 };
B2 b2_3 = { c2, a2, a2 };
union u { int a; char* b; }; #if __cplusplus >= 201103L
#endif
u u1 = { 1 };
u u2 = u1;
u u3 = 1; u u4 = { 0, "asdf" }; u u5 = { "asdf" };