Don't Force Use
In a previous MR !2604 (merged) tried to fix the problem of symbols being discarded by GCC during linking time when optimization is on. The solution used the
used attribute to force a symbol to be considered as used. However, the root cause is very likely not due to a symbol simply been dropped by the linker, it is due to the
static keyword in front of these function templates.
static keywords makes a function internal linkage and safe to be optimized out during linking if the said function is not used by the translation unit. However, this is not the case. Another downside of static function template is that each translation unit has all the instantiations of the functions and can not be consolidated at linking time, causing bloated binary files.
This has been tested with GCC 11 which was reported to exhibit the problem (and was reproduced).