summaryrefslogtreecommitdiffstats
path: root/Source/Checks
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-11-18 18:15:49 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2019-11-27 15:03:04 (GMT)
commitfc3b4caa2e6a1970c75830445ef4aa7d03c5a533 (patch)
tree83e8eef4e853baab91218bf49120f04b342b8d96 /Source/Checks
parent7046a5219893436cbe19b6973ac13fb489199601 (diff)
downloadCMake-fc3b4caa2e6a1970c75830445ef4aa7d03c5a533.zip
CMake-fc3b4caa2e6a1970c75830445ef4aa7d03c5a533.tar.gz
CMake-fc3b4caa2e6a1970c75830445ef4aa7d03c5a533.tar.bz2
Memory management: cast functions for managed pointers
Diffstat (limited to 'Source/Checks')
-rw-r--r--Source/Checks/cm_cxx14_check.cmake2
-rw-r--r--Source/Checks/cm_cxx17_check.cmake2
-rw-r--r--Source/Checks/cm_cxx17_check.cpp10
3 files changed, 12 insertions, 2 deletions
diff --git a/Source/Checks/cm_cxx14_check.cmake b/Source/Checks/cm_cxx14_check.cmake
index 8e9c2c7..e5656bf 100644
--- a/Source/Checks/cm_cxx14_check.cmake
+++ b/Source/Checks/cm_cxx14_check.cmake
@@ -1,5 +1,5 @@
set(CMake_CXX14_BROKEN 0)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI|Intel")
if(NOT CMAKE_CXX14_STANDARD_COMPILE_OPTION)
set(CMake_CXX14_WORKS 0)
endif()
diff --git a/Source/Checks/cm_cxx17_check.cmake b/Source/Checks/cm_cxx17_check.cmake
index 9e1d9c3..dba3eaf 100644
--- a/Source/Checks/cm_cxx17_check.cmake
+++ b/Source/Checks/cm_cxx17_check.cmake
@@ -1,5 +1,5 @@
set(CMake_CXX17_BROKEN 0)
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI|Intel")
if(NOT CMAKE_CXX17_STANDARD_COMPILE_OPTION)
set(CMake_CXX17_WORKS 0)
endif()
diff --git a/Source/Checks/cm_cxx17_check.cpp b/Source/Checks/cm_cxx17_check.cpp
index 29863b1..abbe22c 100644
--- a/Source/Checks/cm_cxx17_check.cpp
+++ b/Source/Checks/cm_cxx17_check.cpp
@@ -8,6 +8,13 @@
# include <comdef.h>
#endif
+template <typename T,
+ typename std::invoke_result<decltype(&T::get), T>::type = nullptr>
+typename T::pointer get_ptr(T& item)
+{
+ return item.get();
+}
+
int main()
{
int a[] = { 0, 1, 2 };
@@ -20,6 +27,9 @@ int main()
std::unique_ptr<int> u(new int(0));
+ // Intel compiler do not handle correctly 'decltype' inside 'invoke_result'
+ get_ptr(u);
+
#ifdef _MSC_VER
// clang-cl has problems instantiating this constructor in C++17 mode
// error: indirection requires pointer operand ('const _GUID' invalid)