Skip to content

Clang: For MSVC ABI do not use modes older than C++14

Brad King requested to merge brad.king/cmake:clang-gnulike-support into master

Since !2992 (merged) we support the GNU-like Clang that targets the MSVC ABI. However, Clang cannot compile with the MSVC standard library unless it runs in a mode aware of C++14 (since MSVC itself does not even have a lower mode). When CMAKE_CXX_STANDARD is set to 98 or 11, use C++14 anyway.

Since Clang's default mode is aware of C++14, another option is to not add any flags for 98 or 11. However, if a future Clang version ever defaults to a higher C++ standard, setting the standard to 98 or 11 should at least not use a mode higher than 14.

Also revert test and tutorial updates from !2992 (merged) that were meant to work around the standard selection problem. In particular, changing the tests in this way broke the tutorial's narrative.

Fixes: #19496 (closed)

Edited by Brad King

Merge request reports