[clang] [Clang] Fix "Unions cannot be dynamic classes" assertion (PR #217942)

Akash Manna via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 00:24:48 PDT 2026


akash-manna-sky wrote:

Thanks, agreed. After analyzing the discussions, I've dropped the `addedMember` change and fixed the recovery in `HandleDeclarator` instead: when the qualifier names a different class, the declaration is now marked invalid, same as we already do for virtual in a union. `addedMember` skips invalid `decls`, so the union can't become polymorphic, the body is still parsed and the node stays in the AST.  Dropping the node instead could be done if you'd prefer that.

One thing: `template<> void A::f<double>()`; in `cwg727` no longer gets the follow-up "no function template matches" error, which was bogus I think — I've updated that expectation.

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


More information about the cfe-commits mailing list