================
@@ -2937,6 +2937,8 @@ InitListChecker::CheckDesignatedInitializer(const 
InitializedEntity &Entity,
     }
 
     FieldDecl *KnownField = D->getFieldDecl();
+    if (KnownField && KnownField->getParent() != RD)
+      KnownField = nullptr;
----------------
Backl1ght wrote:

> We need some comments/explanation for this workaround.
I have update a more detailed pr description.

> If this is related to cache, is it possible for us to fix that instead?
No I think, the saved FieldDecl will be used in later actions while anonymous 
structs/unions require us to use saved FieldDecl. Another possible way is clear 
the saved FieldDecl somewhere, but I can not find a proper place.

https://github.com/llvm/llvm-project/pull/167159
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to