You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
structwith_explicit_fielda; // expected-warning {{field in 'with_explicit_field' is not explicitly initialized, but was marked as requiring explicit initialization}} expected-note@#FIELD_Y {{'y' declared here}}
562
570
structwith_explicit_fieldb= {1}; // expected-warning {{field 'y' is not explicitly initialized, but was marked as requiring explicit initialization}} expected-note@#FIELD_Y {{'y' declared here}}
563
571
(void)(&a!=&b);
572
+
573
+
structwith_explicit_fieldc= {1, 2};
574
+
structwith_explicit_fieldd= {.y=3};
575
+
(void)(&c!=&d);
576
+
577
+
structwith_explicit_arraye= {{1}}; // OK -- part of array is still initialized
578
+
(void)e;
579
+
580
+
structwith_explicit_arrayf= {}; // expected-warning {{field 'flex_arr' is not explicitly initialized, but was marked as requiring explicit initialization}} expected-note@#FIELD_FLEX_ARR {{'flex_arr' declared here}}
int g2 [[clang::requires_explicit_initialization]]; // #FIELD_G2
1486
+
};
1487
+
1488
+
structSpecial {};
1489
+
1490
+
template<>
1491
+
structInherit<Special> {
1492
+
int g3 [[clang::requires_explicit_initialization]]; // #FIELD_G3
1493
+
};
1494
+
1495
+
template<>
1496
+
structInheritWithExplicit<Special> {
1497
+
int g4; // #FIELD_G4
1498
+
};
1499
+
1476
1500
voidaggregate() {
1477
1501
structNonAgg {
1478
1502
NonAgg() { }
@@ -1490,7 +1514,7 @@ void aggregate() {
1490
1514
};
1491
1515
1492
1516
structC {
1493
-
[[clang::requires_explicit_initialization]] int c1 = 2; // #FIELD_C1
1517
+
[[clang::requires_explicit_initialization]] int c1; // #FIELD_C1
1494
1518
C() = default; // Test pre-C++20 aggregates
1495
1519
};
1496
1520
@@ -1573,4 +1597,18 @@ void aggregate() {
1573
1597
// expected-note@#FIELD_D2 {{'d2' declared here}}
1574
1598
E e;
1575
1599
(void)e;
1600
+
1601
+
InheritWithExplicit<> agg;
1602
+
(void)agg;
1603
+
// expected-warning@#TYPE_INHERIT_WITH_EXPLICIT {{field in 'InheritWithExplicit<>' is not explicitly initialized, but was marked as requiring explicit initialization}} expected-note@#FIELD_G2 {{'g2' declared here}}
// expected-warning@#TYPE_INHERIT_WITH_EXPLICIT {{field in 'Inherit<Special>' is not explicitly initialized, but was marked as requiring explicit initialization}} expected-note@#FIELD_G3 {{'g3' declared here}}
0 commit comments