-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest6.cpp
More file actions
93 lines (72 loc) · 1.61 KB
/
test6.cpp
File metadata and controls
93 lines (72 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class Test6_1 {
public:
int x, y;
void fun();
};
class Test6_2 {
private:
int x, y;
void fun();
};
class Test6_3 {
public:
int x;
private:
int y; // different access control -> not standard layout
};
class Test6_4 {
public:
virtual void fun(); // virtual function -> not standard layout, not trivial
};
// ---
class Test6_20 : public Test6_1 {
static int z;
};
class Test6_21 : public Test6_1 {
int z; // non-static variable in more than one part of in heritance graph -> not standard layout
};
class Test6_22 : public Test6_3 { // non-standard layout base class -> not standard layout
};
class Test6_23 : public virtual Test6_1 { // virtual inheritance -> not standard layout, not trivial
};
class Test6_24 {
public:
Test6_3 obj; // non-standard layout, non-static variable -> not standard layout
};
class Test6_25 {
public:
static Test6_3 obj;
};
class Test6_26 {
public:
Test6_3 &obj_ref; // non-standard layout, non-static variable -> not standard layout
};
class Test6_27 {
public:
Test6_3 obj_arr[10]; // non-standard layout, non-static variable -> not standard layout
};
// ---
class Test6_30 {
};
class Test6_31 : public Test6_30 {
public:
Test6_30 obj; // base class has same type as first non-static variable -> not standard layout
};
class Test6_32 : public Test6_30 {
public:
int x;
Test6_30 obj;
Test6_30 &obj_ref;
Test6_30 obj_arr[10];
};
// ---
class Test6_40 {
public:
Test6_40() {}; // user provided constructor -> not trivial
};
class Test6_41 : public Test6_40 { // base class non-trivial -> not trivial
};
class Test6_42 {
public:
Test6_40 obj; // non-trivial variable -> not trivial
};