[clang] [clang] Diagnose when spelled 'abi_tag' on namespace doesn't match applied one. (PR #221039)
Dmitry Polukhin via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 13 01:46:28 PDT 2026
dmpolukhin wrote:
Which declaration is wrong depends on where the two declarations live. If both are in user code, I agree: the reopening is the one trying to add tags, so it should get the warning, with "previous declaration is here". But in the case that motivated this, the tag-adding declaration is libstdc++'s `inline namespace __cxx11 __attribute__((__abi_tag__("cxx11")))`, and that one is correct. The wrong one is the user's untagged forward declaration that came first, and a warning on libstdc++'s declaration would be suppressed anyway because it's in a system header.
So I'd suggest warning at whichever declaration is not in a system header: the reopening by default, with your wording and "previous declaration is here", and the first declaration only when the reopening is in a system header, with "later declaration is here".
https://github.com/llvm/llvm-project/pull/221039
More information about the cfe-commits
mailing list