@@ -58,13 +58,10 @@ static_assert(pointerAssign2() == 12, "");
5858
5959constexpr int unInitLocal () {
6060 int a;
61- return a; // ref-note {{read of uninitialized object}} \
62- // expected-note {{read of uninitialized object}}
61+ return a; // both-note {{read of uninitialized object}}
6362}
64- static_assert (unInitLocal() == 0 , " " ); // ref-error {{not an integral constant expression}} \
65- // ref-note {{in call to 'unInitLocal()'}} \
66- // expected-error {{not an integral constant expression}} \
67- // expected-note {{in call to 'unInitLocal()'}} \
63+ static_assert (unInitLocal() == 0 , " " ); // both-error {{not an integral constant expression}} \
64+ // both-note {{in call to 'unInitLocal()'}}
6865
6966constexpr int initializedLocal () {
7067 int a;
@@ -75,25 +72,19 @@ static_assert(initializedLocal() == 20);
7572
7673constexpr int initializedLocal2 () {
7774 int a[2 ];
78- return *a; // expected-note {{read of uninitialized object is not allowed in a constant expression}} \
79- // ref-note {{read of uninitialized object is not allowed in a constant expression}}
75+ return *a; // both-note {{read of uninitialized object is not allowed in a constant expression}}
8076}
81- static_assert (initializedLocal2() == 20 ); // expected-error {{not an integral constant expression}} \
82- // expected-note {{in call to}} \
83- // ref-error {{not an integral constant expression}} \
84- // ref-note {{in call to}}
77+ static_assert (initializedLocal2() == 20 ); // both-error {{not an integral constant expression}} \
78+ // both-note {{in call to}}
8579
8680
8781struct Int { int a; };
8882constexpr int initializedLocal3 () {
8983 Int i;
90- return i.a ; // ref-note {{read of uninitialized object is not allowed in a constant expression}} \
91- // expected-note {{read of uninitialized object}}
84+ return i.a ; // both-note {{read of uninitialized object is not allowed in a constant expression}}
9285}
93- static_assert (initializedLocal3() == 20 ); // expected-error {{not an integral constant expression}} \
94- // expected-note {{in call to}} \
95- // ref-error {{not an integral constant expression}} \
96- // ref-note {{in call to}}
86+ static_assert (initializedLocal3() == 20 ); // both-error {{not an integral constant expression}} \
87+ // both-note {{in call to}}
9788
9889
9990
@@ -137,22 +128,16 @@ static_assert(!b4); // ref-error {{not an integral constant expression}} \
137128namespace UninitializedFields {
138129 class A {
139130 public:
140- int a; // expected-note 4{{subobject declared here}} \
141- // ref-note 4{{subobject declared here}}
131+ int a; // both-note 4{{subobject declared here}}
142132 constexpr A () {}
143133 };
144- constexpr A a; // expected-error {{must be initialized by a constant expression}} \
145- // expected-note {{subobject 'a' is not initialized}} \
146- // ref-error {{must be initialized by a constant expression}} \
147- // ref-note {{subobject 'a' is not initialized}}
148- constexpr A aarr[2 ]; // expected-error {{must be initialized by a constant expression}} \
149- // expected-note {{subobject 'a' is not initialized}} \
150- // ref-error {{must be initialized by a constant expression}} \
151- // ref-note {{subobject 'a' is not initialized}}
134+ constexpr A a; // both-error {{must be initialized by a constant expression}} \
135+ // both-note {{subobject 'a' is not initialized}}
136+ constexpr A aarr[2 ]; // both-error {{must be initialized by a constant expression}} \
137+ // both-note {{subobject 'a' is not initialized}}
152138 class F {
153139 public:
154- int f; // expected-note 3{{subobject declared here}} \
155- // ref-note 3{{subobject declared here}}
140+ int f; // both-note 3{{subobject declared here}}
156141
157142 constexpr F () {}
158143 constexpr F (bool b) {
@@ -161,83 +146,64 @@ namespace UninitializedFields {
161146 }
162147 };
163148
164- constexpr F foo[2 ] = {true }; // expected-error {{must be initialized by a constant expression}} \
165- // expected-note {{subobject 'f' is not initialized}} \
166- // ref-error {{must be initialized by a constant expression}} \
167- // ref-note {{subobject 'f' is not initialized}}
168- constexpr F foo2[3 ] = {true , false , true }; // expected-error {{must be initialized by a constant expression}} \
169- // expected-note {{subobject 'f' is not initialized}} \
170- // ref-error {{must be initialized by a constant expression}} \
171- // ref-note {{subobject 'f' is not initialized}}
172- constexpr F foo3[3 ] = {true , true , F ()}; // expected-error {{must be initialized by a constant expression}} \
173- // expected-note {{subobject 'f' is not initialized}} \
174- // ref-error {{must be initialized by a constant expression}} \
175- // ref-note {{subobject 'f' is not initialized}}
149+ constexpr F foo[2 ] = {true }; // both-error {{must be initialized by a constant expression}} \
150+ // both-note {{subobject 'f' is not initialized}}
151+ constexpr F foo2[3 ] = {true , false , true }; // both-error {{must be initialized by a constant expression}} \
152+ // both-note {{subobject 'f' is not initialized}}
153+ constexpr F foo3[3 ] = {true , true , F ()}; // both-error {{must be initialized by a constant expression}} \
154+ // both-note {{subobject 'f' is not initialized}}
176155
177156
178157
179158 class Base {
180159 public:
181160 bool b;
182- int a; // expected-note {{subobject declared here}} \
183- // ref-note {{subobject declared here}}
161+ int a; // both-note {{subobject declared here}}
184162 constexpr Base () : b(true ) {}
185163 };
186164
187165 class Derived : public Base {
188166 public:
189167 constexpr Derived () : Base() {} };
190168
191- constexpr Derived D; // expected-error {{must be initialized by a constant expression}} \
192- // expected-note {{subobject 'a' is not initialized}} \
193- // ref-error {{must be initialized by a constant expression}} \
194- // ref-note {{subobject 'a' is not initialized}}
169+ constexpr Derived D; // both-error {{must be initialized by a constant expression}} \
170+ // both-note {{subobject 'a' is not initialized}}
195171
196172 class C2 {
197173 public:
198174 A a;
199175 constexpr C2 () {} };
200- constexpr C2 c2; // expected-error {{must be initialized by a constant expression}} \
201- // expected-note {{subobject 'a' is not initialized}} \
202- // ref-error {{must be initialized by a constant expression}} \
203- // ref-note {{subobject 'a' is not initialized}}
176+ constexpr C2 c2; // both-error {{must be initialized by a constant expression}} \
177+ // both-note {{subobject 'a' is not initialized}}
204178
205179 class C3 {
206180 public:
207181 A a[2 ];
208182 constexpr C3 () {}
209183 };
210- constexpr C3 c3; // expected-error {{must be initialized by a constant expression}} \
211- // expected-note {{subobject 'a' is not initialized}} \
212- // ref-error {{must be initialized by a constant expression}} \
213- // ref-note {{subobject 'a' is not initialized}}
184+ constexpr C3 c3; // both-error {{must be initialized by a constant expression}} \
185+ // both-note {{subobject 'a' is not initialized}}
214186
215187 class C4 {
216188 public:
217- bool B[2 ][3 ]; // expected-note {{subobject declared here}} \
218- // ref-note {{subobject declared here}}
189+ bool B[2 ][3 ]; // both-note {{subobject declared here}}
219190 constexpr C4 (){}
220191 };
221- constexpr C4 c4; // expected-error {{must be initialized by a constant expression}} \
222- // expected-note {{subobject 'B' is not initialized}} \
223- // ref-error {{must be initialized by a constant expression}} \
224- // ref-note {{subobject 'B' is not initialized}}
192+ constexpr C4 c4; // both-error {{must be initialized by a constant expression}} \
193+ // both-note {{subobject 'B' is not initialized}}
225194};
226195
227196namespace ConstThis {
228197 class Foo {
229- const int T = 12 ; // expected-note {{declared const here}} \
230- // ref-note {{declared const here}}
198+ const int T = 12 ; // both-note {{declared const here}}
231199 int a;
232200 public:
233201 constexpr Foo () {
234202 this ->a = 10 ;
235- T = 13 ; // expected-error {{cannot assign to non-static data member 'T' with const-qualified type}} \
236- // ref-error {{cannot assign to non-static data member 'T' with const-qualified type}}
203+ T = 13 ; // both-error {{cannot assign to non-static data member 'T' with const-qualified type}}
237204 }
238205 };
239- constexpr Foo F; // expected-error {{must be initialized by a constant expression}} \
240- // ref-error {{must be initialized by a constant expression}}
206+ constexpr Foo F; // both-error {{must be initialized by a constant expression}}
241207
242208
243209 class FooDtor {
@@ -264,8 +230,7 @@ namespace ConstThis {
264230 constexpr ctor_test () {
265231 if (Good)
266232 a = 10 ;
267- int local = 100 / a; // expected-note {{division by zero}} \
268- // ref-note {{division by zero}}
233+ int local = 100 / a; // both-note {{division by zero}}
269234 }
270235 };
271236
@@ -277,22 +242,17 @@ namespace ConstThis {
277242 constexpr ~dtor_test () {
278243 if (Good)
279244 a = 10 ;
280- int local = 100 / a; // expected-note {{division by zero}} \
281- // ref-note {{division by zero}}
245+ int local = 100 / a; // both-note {{division by zero}}
282246 }
283247 };
284248
285249 constexpr ctor_test<true > good_ctor;
286250 constexpr dtor_test<true > good_dtor;
287251
288- constexpr ctor_test<false > bad_ctor; // expected-error {{must be initialized by a constant expression}} \
289- // expected-note {{in call to}} \
290- // ref-error {{must be initialized by a constant expression}} \
291- // ref-note {{in call to}}
292- constexpr dtor_test<false > bad_dtor; // expected-error {{must have constant destruction}} \
293- // expected-note {{in call to}} \
294- // ref-error {{must have constant destruction}} \
295- // ref-note {{in call to}}
252+ constexpr ctor_test<false > bad_ctor; // both-error {{must be initialized by a constant expression}} \
253+ // both-note {{in call to}}
254+ constexpr dtor_test<false > bad_dtor; // both-error {{must have constant destruction}} \
255+ // both-note {{in call to}}
296256};
297257
298258namespace BaseInit {
@@ -311,10 +271,8 @@ namespace BaseInit {
311271 };
312272
313273 static_assert (Final{1 , 2 , 3 }.c == 3 , " " ); // OK
314- static_assert (Final{1 , 2 , 3 }.a == 0 , " " ); // expected-error {{not an integral constant expression}} \
315- // expected-note {{read of uninitialized object}} \
316- // ref-error {{not an integral constant expression}} \
317- // ref-note {{read of uninitialized object}}
274+ static_assert (Final{1 , 2 , 3 }.a == 0 , " " ); // both-error {{not an integral constant expression}} \
275+ // both-note {{read of uninitialized object}}
318276
319277
320278 struct Mixin {
@@ -333,10 +291,8 @@ namespace BaseInit {
333291
334292 static_assert (Final2{1 , 2 , 3 }.c == 3 , " " ); // OK
335293 static_assert (Final2{1 , 2 , 3 }.b == 2 , " " ); // OK
336- static_assert (Final2{1 , 2 , 3 }.a == 0 , " " ); // expected-error {{not an integral constant expression}} \
337- // expected-note {{read of uninitialized object}} \
338- // ref-error {{not an integral constant expression}} \
339- // ref-note {{read of uninitialized object}}
294+ static_assert (Final2{1 , 2 , 3 }.a == 0 , " " ); // both-error {{not an integral constant expression}} \
295+ // both-note {{read of uninitialized object}}
340296
341297
342298 struct Mixin3 {
@@ -352,10 +308,8 @@ namespace BaseInit {
352308
353309 static_assert (Final3{1 , 2 , 3 }.c == 3 , " " ); // OK
354310 static_assert (Final3{1 , 2 , 3 }.b == 2 , " " ); // OK
355- static_assert (Final3{1 , 2 , 3 }.a == 0 , " " ); // expected-error {{not an integral constant expression}} \
356- // expected-note {{read of uninitialized object}} \
357- // ref-error {{not an integral constant expression}} \
358- // ref-note {{read of uninitialized object}}
311+ static_assert (Final3{1 , 2 , 3 }.a == 0 , " " ); // both-error {{not an integral constant expression}} \
312+ // both-note {{read of uninitialized object}}
359313};
360314
361315namespace Destructors {
@@ -633,16 +587,13 @@ namespace ImplicitFunction {
633587
634588 // / The operator= call here will fail and the diagnostics should be fine.
635589 b = a; // ref-note {{subobject 'a' is not initialized}} \
636- // ref-note {{in call to}} \
637590 // expected-note {{read of uninitialized object}} \
638- // expected -note {{in call to}}
591+ // both -note {{in call to}}
639592
640593 return 1 ;
641594 }
642- static_assert (callMe() == 1 , " " ); // ref-error {{not an integral constant expression}} \
643- // ref-note {{in call to 'callMe()'}} \
644- // expected-error {{not an integral constant expression}} \
645- // expected-note {{in call to 'callMe()'}}
595+ static_assert (callMe() == 1 , " " ); // both-error {{not an integral constant expression}} \
596+ // both-note {{in call to 'callMe()'}}
646597}
647598
648599// / FIXME: Unfortunately, the similar tests in test/SemaCXX/{compare-cxx2a.cpp use member pointers,
@@ -680,8 +631,7 @@ namespace ThreeWayCmp {
680631 static_assert (1.0 <=> 2 .f == -1 , " " );
681632 static_assert (1.0 <=> 1.0 == 0 , " " );
682633 static_assert (2.0 <=> 1.0 == 1 , " " );
683- constexpr int k = (1 <=> 1 , 0 ); // expected-warning {{comparison result unused}} \
684- // ref-warning {{comparison result unused}}
634+ constexpr int k = (1 <=> 1 , 0 ); // both-warning {{comparison result unused}}
685635 static_assert (k== 0 , " " );
686636
687637 // / Pointers.
@@ -690,10 +640,8 @@ namespace ThreeWayCmp {
690640 constexpr const int *pa1 = &a[1 ];
691641 constexpr const int *pa2 = &a[2 ];
692642 constexpr const int *pb1 = &b[1 ];
693- static_assert (pa1 <=> pb1 != 0 , " " ); // expected-error {{not an integral constant expression}} \
694- // expected-note {{has unspecified value}} \
695- // ref-error {{not an integral constant expression}} \
696- // ref-note {{has unspecified value}}
643+ static_assert (pa1 <=> pb1 != 0 , " " ); // both-error {{not an integral constant expression}} \
644+ // both-note {{has unspecified value}} \
697645 static_assert(pa1 <=> pa1 == 0, "");
698646 static_assert (pa1 <=> pa2 == -1 , " " );
699647 static_assert (pa2 <=> pa1 == 1 , " " );
0 commit comments