Skip to content
Snippets Groups Projects
Commit 79646628 authored by Brad King's avatar Brad King
Browse files

bootstrap: Fix support for Intel compiler with modern GNU system compiler

On systems with older GNU system compilers, the Intel C++ compiler does
not define `__cplusplus` to any version newer than C++11.  This
prevented `bootstrap` from detecting that a given C++ standard flag has
enabled C++17 mode in the compiler.  In commit 033a4b12 (bootstrap:
Extend C++17 check for our cast functions, 2019-12-14,
v3.17.0-rc1~291^2) we added a preprocessor condition to attempt to
detect C++17 mode in the Intel compiler on such systems by looking
for `__cpp_if_constexpr`.  However, on systems with a modern GNU
system compiler, that definition is available even in C++11 mode.

Switch to using `__cpp_deduction_guides` to detect C++17 mode for the
Intel C++ compiler.  That seems to be defined exclusively in C++17 mode
regardless of the version of the system compiler.

Fixes: #21013
parent e6479495
No related branches found
No related tags found
No related merge requests found
......@@ -1168,7 +1168,7 @@ int check_cxx14()
}
#endif
#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_if_constexpr))
#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_deduction_guides))
#include <optional>
template <typename T,
typename std::invoke_result<decltype(&T::get), T>::type = nullptr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment