[clang] [Clang] disallow selectany on non-global-variable declarations (PR #189641)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri May 8 04:12:40 PDT 2026
AaronBallman 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?
> Static Data Members: These are rejected because MSVC requires selectany to be applied to global or namespace-scope objects.
The definition of the static data member is still not global or namespace scoped.
I think it's worth reverting while we discuss what to do; we can't break system headers like that.
https://github.com/llvm/llvm-project/pull/189641
More information about the cfe-commits
mailing list