Description
Compiling with emscripten (clang 18.0.0) on Windows does not work. An error about a supposedly wrong C++ version is reported:
setup.hpp:640:3: error: 'constexpr' specifier is incompatible with C++98 [-Werror,-Wc++98-compat]
640 | constexpr std::size_t countof(T const (&)[N])
even though -std=c++20 is used:
em++.bat -DGLM_FORCE_CXX17 -IE:/projects/wasm-test/cmake-build-debug/_deps/glm-src -g -std=c++17 -fcolor-diagnostics -Wno-c++98-compat -Wno-c++98-compat-pedantic -Werror -Weverything -MD -MT _deps/glm-build/glm/CMakeFiles/glm.dir/detail/glm.cpp.o -MF _deps\glm-build\glm\CMakeFiles\glm.dir\detail\glm.cpp.o.d -o _deps/glm-build/glm/CMakeFiles/glm.dir/detail/glm.cpp.o -c E:/projects/wasm-test/cmake-build-debug/_deps/glm-src/glm/detail/glm.cpp
With GLM_ENABLE_CXX_17 set to ON, the compilation will continue until the next error is reported:
func_packing.inl:20:3: error: unsafe buffer access [-Werror,-Wunsafe-buffer-usage]
20 | u.in[1] = result[1];
It turns out that the problem with clang are the strict complie options at line 244 in the CMakeLists.txt file.
Compilation works when removing these options.
Now my question: is this done on purpose? Until now I only used glm with gcc/mingw without any problems. Unfortunately, I only have the clang compiler within emscripten at hand and cannot test it with the plain clang compiler.