@@ -5880,6 +5880,12 @@ static void TryOrBuildParenListInitialization(
5880
5880
} else {
5881
5881
// We've processed all of the args, but there are still members that
5882
5882
// have to be initialized.
5883
+ if (!VerifyOnly && FD->hasAttr <ExplicitInitAttr>()) {
5884
+ S.Diag (Kind.getLocation (), diag::warn_field_requires_explicit_init)
5885
+ << /* Var-in-Record */ 0 << FD;
5886
+ S.Diag (FD->getLocation (), diag::note_entity_declared_at) << FD;
5887
+ }
5888
+
5883
5889
if (FD->hasInClassInitializer ()) {
5884
5890
if (!VerifyOnly) {
5885
5891
// C++ [dcl.init]p16.6.2.2
@@ -7351,6 +7357,22 @@ PerformConstructorInitialization(Sema &S,
7351
7357
if (S.DiagnoseUseOfDecl (Step.Function .FoundDecl , Loc))
7352
7358
return ExprError ();
7353
7359
7360
+ if (Kind.getKind () == InitializationKind::IK_Value &&
7361
+ Constructor->isImplicit ()) {
7362
+ auto *RD = Step.Type .getCanonicalType ()->getAsCXXRecordDecl ();
7363
+ if (RD && RD->isAggregate () && RD->hasUninitializedExplicitInitFields ()) {
7364
+ unsigned I = 0 ;
7365
+ for (const FieldDecl *FD : RD->fields ()) {
7366
+ if (I >= ConstructorArgs.size () && FD->hasAttr <ExplicitInitAttr>()) {
7367
+ S.Diag (Loc, diag::warn_field_requires_explicit_init)
7368
+ << /* Var-in-Record */ 0 << FD;
7369
+ S.Diag (FD->getLocation (), diag::note_entity_declared_at) << FD;
7370
+ }
7371
+ ++I;
7372
+ }
7373
+ }
7374
+ }
7375
+
7354
7376
TypeSourceInfo *TSInfo = Entity.getTypeSourceInfo ();
7355
7377
if (!TSInfo)
7356
7378
TSInfo = S.Context .getTrivialTypeSourceInfo (Entity.getType (), Loc);
0 commit comments