================
@@ -743,6 +743,12 @@ void InitListChecker::FillInEmptyInitForField(unsigned 
Init, FieldDecl *Field,
         ILE->updateInit(SemaRef.Context, Init, Filler);
       return;
     }
+
+    if (Field->hasAttr<ExplicitInitAttr>()) {
+      SemaRef.Diag(ILE->getExprLoc(), diag::warn_field_requires_explicit_init)
+          << Field;
----------------
ilya-biryukov wrote:

Maybe we could also add the `note_entity_declared_at` pointing at field's 
location?

It will mostly be redundant, but can sometimes really come in handy if the 
field names happen to clash with base classes, e.g. 
https://gcc.godbolt.org/z/Pzx9PE3Mh

However, this also adds noise.


https://github.com/llvm/llvm-project/pull/102040
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to