The code in question was added to the bootstrap script by CMake MR 4139 for consistency with normal CMake configure step check added by CMake MR 4064. The defined(__INTEL_COMPILER) && defined(__cpp_if_constexpr) condition is an attempt at determining whether Intel 19+ is in C++17 mode since __cplusplus never seems to go above 201103L.
As of icpc 19.1.0.166 the bootstrap script still works for me and chooses -std=gnu++14. Is this failure new to icpc 19.1.1.217? Why wouldn’t it just fail the C++17 check and fall back to C++14 like in other versions? Is __cpp_if_constexpr defined in pre-17 modes with that version?
The proposed code:
#if (!defined(__INTEL_COMPILER) && __cplusplus >= 201703L \
|| defined(__INTEL_COMPILER) && defined(__cpp_deduction_guides) \
&& __cpp_deduction_guides > 201703L)
looks like it is using __cpp_deduction_guides instead of __cpp_if_constexpr to detect C++17 support. I’d be fine with switching to that but I’d like to understand what goes wrong with the current code first.
Also, is the !defined(__INTEL_COMPILER) part actually needed? AFAIK the Intel compiler never defines __cplusplus >= 201703L, and if it ever does the code being checked should work.