[clang] [Clang] disallow selectany on non-global-variable declarations (PR #189641)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Fri May 8 04:20:04 PDT 2026
mstorsjo wrote:
> > MSVC only diagnoses on the declaration of SA static int i; (and the non-static SA int j; as well - GCC also diagnoses that one).
> > But MSVC does not diagnose any error on SA int T::i = 42;, neither does GCC.
>
> That still doesn't match what Microsoft said in the issue report though, right?
Maybe - I don't think the wording of their reply was nuanced enough to cover this case as it wasn't included as part of the discussion examples, so they probably didn't think of it. I think the main key word is external linkage in any case.
> I think it's worth reverting while we discuss what to do; we can't break system headers like that.
Yes that sounds reasonable to me, especially as it seems like the previous wording of the conclusion was inaccurate.
https://github.com/llvm/llvm-project/pull/189641
More information about the cfe-commits
mailing list