Browse Source

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.
Brad King 6 years ago
parent
commit
033a4b12a5
1 changed files with 11 additions and 1 deletions
  1. 11 1
      bootstrap

+ 11 - 1
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();
 }