Open dunhor opened 1 month ago
@llvm/issue-subscribers-clang-frontend
Author: Duncan Horn (dunhor)
Under C++ rules for type definitions, there isn't any way to actually declare the variable in question outside the current translation unit. (The type has no linkage, so any other declaration would have a different type, which violates ODR.) So marking it selectany is, at best, useless.
Probably the diagnostics here could be improved.
Wow that title is a mouthful. Here's a concrete example:
clang-cl gives the error:
Of course, if you give the struct its own definition, the code compiles fine:
MSVC compiles both without issue.