Disservin / chess-library

C++ chess library
https://disservin.github.io/chess-library/
MIT License
63 stars 20 forks source link

fix constexpr for visualstudio compiler #75

Closed tolstenko closed 5 months ago

tolstenko commented 5 months ago

I couldn't explore this deeply, but it fix the constexpr problem on VS2022. Strangelly clang and GCC doesn't needs this fix.

Disservin commented 5 months ago

Thanks for pointing this out actually, std::tolower is not constexpr, which makes msvc throw an error because they are (somewhat) smart. Clang/GCC don't throw an error because that ctor for File/Rank hasn't been yet used in a constexpr context.

I just pushed a fix with a custom constexpr tolower implemention and a few things were missing here, for example you were editing the include file directly but that file is auto generated see THIS FILE IS AUTO GENERATED DO NOT CHANGE MANUALLY. :) My actual source files are in ./src and those get combined together into a single header file after meson compile -C build

tolstenko commented 5 months ago

Seems good to me :-). I am glad to help. Probably, this type of issue could have been gotten earlier if the CI had a matrix for OS. runs-on:. I could do this if you find it interesting.