Skip to content

support clang-cl#35

Merged
sebsjames merged 3 commits into
sebsjames:mainfrom
miyanyan:support-clang-cl
Jul 17, 2025
Merged

support clang-cl#35
sebsjames merged 3 commits into
sebsjames:mainfrom
miyanyan:support-clang-cl

Conversation

@miyanyan
Copy link
Copy Markdown
Contributor

the same changes as maths

@miyanyan
Copy link
Copy Markdown
Contributor Author

I got the constexpr steps related error:

[build] C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\Llvm\x64\bin\clang-cl.exe  /nologo -TP -DH5_BUILT_AS_DYNAMIC_LIB -ID:\github\miyanyan\mathplot -ID:\github\miyanyan\vcpkg\installed\x64-windows\include -ID:\github\miyanyan\mathplot\maths -ID:\github\miyanyan\mathplot\include\rapidxml-1.13 -DNOMINMAX /EHsc /Zc:__cplusplus /constexpr:steps500000000 -DMPLOT_HAVE_STD_FORMAT -Xclang -fopenmp -DMPLOT_FONTS_DIR="\"D:/github/miyanyan/mathplot/fonts\""  /MD /O2 /Ob2 /DNDEBUG -std:c++20 /showIncludes /Foexamples\CMakeFiles\testce.dir\testce.cpp.obj /Fdexamples\CMakeFiles\testce.dir\ -c -- D:\github\miyanyan\mathplot\examples\testce.cpp
[build] clang-cl: warning: argument unused during compilation: '/constexpr:steps500000000' [-Wunused-command-line-argument]
[build] D:\github\miyanyan\mathplot\examples\testce.cpp(12,10): error: constexpr variable 'geo' must be initialized by a constant expression
[build]    12 |     auto geo = sm::geometry_ce::make_icosahedral_geodesic<double, 3>();
[build]       |          ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\limits(916,59): note: constexpr evaluation hit maximum step limit; possible infinite loop?
[build]   916 |     _NODISCARD static constexpr double epsilon() noexcept {
[build]       |                                                           ^
[build] D:\github\miyanyan\vcpkg\installed\x64-windows\include\sm/geometry(195,82): note: in call to 'epsilon()'
[build]   195 |                     if (sm::cem::abs(geo.poly.vertices[v][0] - vb[0]) < thresh * std::numeric_limits<F>::epsilon()
[build]       |                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] D:\github\miyanyan\mathplot\examples\testce.cpp(12,16): note: in call to 'make_icosahedral_geodesic<double, 3>()'
[build]    12 |     auto geo = sm::geometry_ce::make_icosahedral_geodesic<double, 3>();
[build]       |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] 1 error generated.

@sebsjames
Copy link
Copy Markdown
Owner

Ok, so I'm not surprised you got the constpexr:steps problem, because there are tests and examples which compile constexpr functions that need more steps than the usual default. Given that clang-cl seems to be unable to set the constexpr steps like normal clang, gcc and normal visual code are able to, then you could instead conditionally disable the compilation of those tests/examples.

@sebsjames
Copy link
Copy Markdown
Owner

sebsjames commented Jul 15, 2025

OR there may be a solution!

Try adding this for clang-cl:

-Xclang -fconstexpr-steps -Xclang 500000000

OR maybe this:

/clang:-fconstexpr-steps=500000000

both of which I found suggested here: https://stackoverflow.com/questions/41010768/clang-cl-exe-and-constexpr-depth

@miyanyan
Copy link
Copy Markdown
Contributor Author

OR there may be a solution!

Try adding this for clang-cl:

-Xclang -fconstexpr-steps -Xclang 500000000

OR maybe this:

/clang:-fconstexpr-steps=500000000

both of which I found suggested here: https://stackoverflow.com/questions/41010768/clang-cl-exe-and-constexpr-depth

worked!

@sebsjames sebsjames merged commit f9da007 into sebsjames:main Jul 17, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants