Experienced CUDA programmer here working on large-scale GPGPU application, using spdlog as logging library. Wanting to migrate from spdlog 1.1 to latest version, however nvcc yields some weird errors.
I am not a language lawyer and am not familiar with the relevant sections of the ISO C++ standard. However, I note that a reference website provides the following tidbit (emphasis mine):
Prior to C++23, the C++ standard says that a constexpr function must return a constexpr value for at least one set of arguments, otherwise it is technically ill-formed. Calling a non-constexpr function unconditionally in a constexpr function makes the constexpr function ill-formed. However, compilers are not required to generate errors or warnings for such cases – therefore, the compiler probably won’t complain unless you try to call such a constexpr function in a constant context. In C++23, this requirement was rescinded.
This might explain the difference in compiler behavior. A proper diagnosis would require a close look at the code the CUDA compiler complains about and some language lawyering along the lines of the quoted section above.
You might also want to try (1) bringing up the issue with spdlog support, as calling a non-constexpr function from a constexpr function may have happened unintentionally (2) switching to the latest CUDA version (for suspected compiler bugs NVIDIA is generally interested in issues that reproduce with the latest version).