VS 2022 17.10 Preview 1 fixed DevCom-10518531 "MSVC doesn't implement CWG-2387 (const-qualified variable templates have external linkage by default)". Clang 9 implemented this long ago (see llvm/llvm-project@bb75068).
This issue was requested by Casey Carter (@CaseyCarter) in #4116 (comment):
we should have an issue reminding us to audit and remove all the extraneous inlines when our supported compilers are all ready.
To resolve this, we should remove inline and _INLINE_VAR from all of our constexpr variable templates (both primary templates and partial specializations).
⚠️ However, explicit specializations of variable templates, and ordinary (non-template) variables, should NOT be modified. They still need inline/_INLINE_VAR.
This change will follow our general rationale of "don't help the compiler". Avoiding unnecessary code helps to emphasize the remaining necessary code. Also, this will make our conventions for constexpr variables nearly identical to our conventions for functions: primary templates and partial specializations don't need inline, while explicit specializations and non-templates do.
I'm less enthusiastic about cleaning up test code (we generally avoid intrusive changes to test code because they're low value; also, test code sometimes intentionally does wacky things, so cleanups have the potential to disrupt what they were testing). In this case, the change is semi-mechanical, the impact is well-understood and limited, and there aren't that many occurrences in test code, so I think it would be acceptable.
VS 2022 17.10 Preview 1 fixed DevCom-10518531 "MSVC doesn't implement CWG-2387 (const-qualified variable templates have external linkage by default)". Clang 9 implemented this long ago (see llvm/llvm-project@bb75068).
This issue was requested by Casey Carter (@CaseyCarter) in #4116 (comment):
To resolve this, we should remove
inlineand_INLINE_VARfrom all of ourconstexprvariable templates (both primary templates and partial specializations).inline/_INLINE_VAR.This change will follow our general rationale of "don't help the compiler". Avoiding unnecessary code helps to emphasize the remaining necessary code. Also, this will make our conventions for
constexprvariables nearly identical to our conventions for functions: primary templates and partial specializations don't needinline, while explicit specializations and non-templates do.I'm less enthusiastic about cleaning up test code (we generally avoid intrusive changes to test code because they're low value; also, test code sometimes intentionally does wacky things, so cleanups have the potential to disrupt what they were testing). In this case, the change is semi-mechanical, the impact is well-understood and limited, and there aren't that many occurrences in test code, so I think it would be acceptable.