summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-12-14 18:28:22 (GMT)
committerBrad King <brad.king@kitware.com>2019-12-14 18:30:54 (GMT)
commit033a4b12a5e5f67f2f00c23885a3ff04acbeb4cd (patch)
tree439e00a459fdb99a58395edb2490ba7a657a8900 /bootstrap
parent2d53894c31c9d6849c67f4c218c0aefed1eb7921 (diff)
downloadCMake-033a4b12a5e5f67f2f00c23885a3ff04acbeb4cd.zip
CMake-033a4b12a5e5f67f2f00c23885a3ff04acbeb4cd.tar.gz
CMake-033a4b12a5e5f67f2f00c23885a3ff04acbeb4cd.tar.bz2
bootstrap: Extend C++17 check for our cast functions
In commit fc3b4caa2e (Memory management: cast functions for managed pointers, 2019-11-18) we added a check to `Source/Checks/cm_cxx17_check.cpp` to avoid using C++17 mode on a compiler that does not support all our C++17 usage. Add the check to our bootstrap script too.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap12
1 files changed, 11 insertions, 1 deletions
diff --git a/bootstrap b/bootstrap
index 6e89589..1b0cb26 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1168,10 +1168,20 @@ int check_cxx14()
}
#endif
-#if __cplusplus >= 201703L
+#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_if_constexpr))
#include <optional>
+template <typename T,
+ typename std::invoke_result<decltype(&T::get), T>::type = nullptr>
+typename T::pointer get_ptr(T& item)
+{
+ return item.get();
+}
+
int check_cxx17()
{
+ // Intel compiler do not handle correctly 'decltype' inside 'invoke_result'
+ std::unique_ptr<int> u(new int(0));
+ get_ptr(u);
std::optional<int> oi = 0;
return oi.value();
}