SafeInt: `static inline` functions are not supported by header units & modules
Would it be possible to make SafeIntExceptionAssert
simply inline
once again?
Here’s the error as seen in msvc
safeint3.hpp(430,20): error C2129: static function ‘void SafeIntExceptionAssert(void) noexcept’ declared but not defined
About this issue
- Original URL
- State: open
- Created 4 months ago
- Comments: 15 (7 by maintainers)
Aha! Changing the safeint type to
unsigned int
did the trick:The compiler is not required to issue a diagnostic for internal linkage names within a header unit, however using such an internal linkage name is ill-formed as per the standard:
[basic.link]/2.3
. Since the header unit is its own translation unit, the internal linkage functionSafeIntExceptionAssert
is not usable from outside.The best way to remove this restriction is to make the function
inline
, which would have the same effect as marking itstatic
, but also allow the linker to deduplicate instances as well which could decrease binary sizes.