To make it compile with MSVC.
Is there a positive change that could be made instead, that would achieve the same goal and preserve the functionality of this code?
The goal is already achieved in cmake files.
I don't think this preserves the intended behavior of the original code -- now MSVC will never check for C++17 mode. I believe the correct way to fix this is to set /Zc:__cplusplus when compiling with MSVC, unless there's a reason that's not possible?
There's a small chance someone could skip CMake entirely and use these files directly (that happens with LLVM support code from time to time, for instance), so I think preserving the behavior of the original code is a reasonable idea. If we set up the CMake to tell MSVC to use the right value for __cplusplus, then the code in idioms.h requires no changes and will do the right thing.