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
Rename [[clang::requires_explicit_initialization]] to [[clang::require_explicit_initialization]] (#122947)
This makes it consistent with
`[[clang::require_constant_initialization]]`.
(The attribute was just added to Clang a few minutes ago, so there are
no users yet.)
[[clang::requires_explicit_initialization]] int na; // expected-warning {{'requires_explicit_initialization' attribute is ignored in non-aggregate type 'NonAgg'}}
1504
+
[[clang::require_explicit_initialization]] int na; // expected-warning {{'require_explicit_initialization' attribute is ignored in non-aggregate type 'NonAgg'}}
1505
1505
};
1506
1506
NonAgg nonagg; // no-warning
1507
1507
(void)nonagg;
1508
1508
1509
1509
structS {
1510
-
[[clang::requires_explicit_initialization]] int s1; // #FIELD_S1
1510
+
[[clang::require_explicit_initialization]] int s1; // #FIELD_S1
1511
1511
int s2;
1512
1512
int s3 = 12;
1513
-
[[clang::requires_explicit_initialization]] int s4 = 100; // #FIELD_S4
1513
+
[[clang::require_explicit_initialization]] int s4 = 100; // #FIELD_S4
1514
1514
staticvoidfoo(S) { }
1515
1515
};
1516
1516
1517
1517
structC {
1518
1518
#if __cplusplus < 202002L
1519
1519
// expected-warning@+1 {{explicit initialization of field 'c1' will not be enforced in C++20 and later because 'C' has a user-declared constructor, making the type no longer an aggregate}}
1520
-
[[clang::requires_explicit_initialization]]
1520
+
[[clang::require_explicit_initialization]]
1521
1521
#endif
1522
1522
int c1; // #FIELD_C1
1523
1523
C() = default; // Test pre-C++20 aggregates
1524
1524
};
1525
1525
1526
1526
structD : S { // #TYPE_D
1527
1527
int d1;
1528
-
int d2 [[clang::requires_explicit_initialization]]; // #FIELD_D2
1528
+
int d2 [[clang::require_explicit_initialization]]; // #FIELD_D2
1529
1529
};
1530
1530
1531
1531
structD2 : D { // #TYPE_D2
1532
1532
};
1533
1533
1534
1534
structE { // #TYPE_E
1535
1535
inte1;
1536
-
D e2 [[clang::requires_explicit_initialization]]; // #FIELD_E2
1536
+
D e2 [[clang::require_explicit_initialization]]; // #FIELD_E2
InheritWithExplicit<> agg; // expected-warning {{field in 'InheritWithExplicit<>' requires explicit initialization but is not explicitly initialized}} expected-note@#FIELD_G2 {{'g2' declared here}}
1637
1637
(void)agg;
1638
1638
1639
-
InheritWithExplicit<Polymorphic> polymorphic; // expected-warning@#FIELD_G2 {{'requires_explicit_initialization' attribute is ignored in non-aggregate type 'InheritWithExplicit<Polymorphic>'}}
1639
+
InheritWithExplicit<Polymorphic> polymorphic; // expected-warning@#FIELD_G2 {{'require_explicit_initialization' attribute is ignored in non-aggregate type 'InheritWithExplicit<Polymorphic>'}}
1640
1640
(void)polymorphic;
1641
1641
1642
1642
Inherit<Special> specialized_explicit; // expected-warning {{field in 'Inherit<Special>' requires explicit initialization but is not explicitly initialized}} expected-note@#FIELD_G3 {{'g3' declared here}}
0 commit comments