MSVC C2099 for log2 initializer in script math registry
Author: HammerkegCreated Sep 11, 2026Updated Sep 11, 2026
Labelsbug
Flecs 674a96ff3d8d21d07081c4159620c07325974ee6 (4.1.6), Windows x64, MSVC 19.44.35228.
Compiling flecs.c as C with /TC /Oi /Ox /fp:precise fails with:
error C2099: initializer is not a constantUsing the existing wrapper pattern—FLECS_MATH_INTRINSIC(log2, log2(x)), then .callback = flecs_math_log2—resolves the compilation error.
Source: SanderMertens/flecs