[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 15:17:04 PST 2024


efriedma-quic wrote:

We could maybe look at setting hadError less aggressively in InitListChecker, for cases where the error is unlikely to impact the overall parse.  If a member has a RecoveryExpr as its initializer, it's probably reasonable to continue producing error messages.

That said, I don't really care if we suppress the second error message in your FibTree example.  It's not a situation I'd expect people to trip over regularly.

------

When I first looked at the pass, I didn't realize the error messages were coming out of delayed C++ field parsing.  I don't think the current version of the patch is viable: modifying RecordDecl::hasInClassInitializer() after it's already been queried is likely to lead to strange results.

https://github.com/llvm/llvm-project/pull/113049


More information about the cfe-commits mailing list