It was a bug. I solved it by updating my CLion IDE, using the newest compiler versions and installing mingw-w64-ucrt-x86_64-gdal-3.10.2-2.