comparison gcc/testsuite/g++.dg/abi/empty4.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
35 NonPod m; 35 NonPod m;
36 36
37 B (long c) {m = c;} 37 B (long c) {m = c;}
38 }; 38 };
39 39
40 #if __cpp_attributes
41 struct B2
42 {
43 [[no_unique_address]] Inter empty;
44 NonPod m;
45
46 B2 (long c) {m = c;}
47 };
48 #endif
49
40 struct C : NonPod, Inter 50 struct C : NonPod, Inter
41 { 51 {
42 C (long c) : NonPod (c), Inter () {} 52 C (long c) : NonPod (c), Inter () {}
43 }; 53 };
44 54
63 A b2 (0x32333435); 73 A b2 (0x32333435);
64 (Inter &)b2 = Inter (); 74 (Inter &)b2 = Inter ();
65 if (b2.m.m != 0x32333435) 75 if (b2.m.m != 0x32333435)
66 return 2; // we copied padding, which clobbered b2.m.m 76 return 2; // we copied padding, which clobbered b2.m.m
67 77
78 {
68 B c (0x12131415); 79 B c (0x12131415);
69 was = c.m.m; 80 was = c.m.m;
70 c = 0x22232425; 81 c = 0x22232425;
71 if (was != now) 82 if (was != now)
72 return 3; 83 return 3;
74 B d (0x32333435); 85 B d (0x32333435);
75 c.empty = d.empty; 86 c.empty = d.empty;
76 87
77 if (c.m.m != 0x22232425) 88 if (c.m.m != 0x22232425)
78 return 4; 89 return 4;
90 }
91 #if __cpp_attributes
92 {
93 B2 c (0x12131415);
94 was = c.m.m;
95 c = 0x22232425;
96 if (was != now)
97 return 3;
98
99 B2 d (0x32333435);
100 c.empty = d.empty;
101
102 if (c.m.m != 0x22232425)
103 return 4;
104 }
105 #endif
79 106
80 C e (0x32333435); 107 C e (0x32333435);
81 108
82 if (e.m != 0x32333435) 109 if (e.m != 0x32333435)
83 return 2; // we copied padding 110 return 2; // we copied padding