CWG-2387 cleanups: Remove inline
/_INLINE_VAR
from constexpr
variable templates
#4533
Labels
inline
/_INLINE_VAR
from constexpr
variable templates
#4533
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 @CaseyCarter in #4116 (comment):
To resolve this, we should remove
inline
and_INLINE_VAR
from all of ourconstexpr
variable 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
constexpr
variables 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.
The text was updated successfully, but these errors were encountered: