[clang] [clang] Use the union of abi_tags from all declarations of an inline namespace (PR #224826)

Dmitry Polukhin via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 00:25:37 PDT 2026


dmpolukhin wrote:

Fair enough — the dependence on when a name is first mangled is the part of this patch I like least as well; the epoch machinery only exists to paper over it, and Sema mangling names for diagnostics makes it worse. I'm OK with not propagating tags backwards.

So let's drop the union and only diagnose:

- warn when a redeclaration of an inline namespace adds an `abi_tag` that the first declaration doesn't have — the only case where Clang silently diverges from GCC;
- no diagnostic for reopening without the attribute or with a subset of the tags: that's libstdc++'s own idiom, and the mangling already matches GCC;
- report the warning at the first declaration, with a note at the declaration adding the tag. In the forward declaration system header case the tag-adding declaration is in a system header, so a warning placed there would be suppressed, while the declaration that needs fixing is the user's.

That's a narrowed version of #221039. I'm closing it in favour of narrowing that one.

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


More information about the cfe-commits mailing list