diff options
author | Brad King <brad.king@kitware.com> | 2019-12-04 19:21:48 +0000 |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-12-04 14:22:01 -0500 |
commit | e9e0e401c657c60ae7916d93321363ba22d3673a (patch) | |
tree | 2a5f818af7d3fd2c385dbaefa3f8db6a6d6ae7f1 /Source/Checks | |
parent | 816aa0740aa2e6f8b15e84c5b9bb95f7b2629847 (diff) | |
parent | fc3b4caa2e6a1970c75830445ef4aa7d03c5a533 (diff) | |
download | cmake-e9e0e401c657c60ae7916d93321363ba22d3673a.tar.gz |
Merge topic 'cmext-memory'
fc3b4caa2e Memory management: cast functions for managed pointers
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4064
Diffstat (limited to 'Source/Checks')
-rw-r--r-- | Source/Checks/cm_cxx14_check.cmake | 2 | ||||
-rw-r--r-- | Source/Checks/cm_cxx17_check.cmake | 2 | ||||
-rw-r--r-- | Source/Checks/cm_cxx17_check.cpp | 10 |
3 files changed, 12 insertions, 2 deletions
diff --git a/Source/Checks/cm_cxx14_check.cmake b/Source/Checks/cm_cxx14_check.cmake index 8e9c2c70a6..e5656bf4ed 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 9e1d9c3eae..dba3eaf3b3 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 29863b136b..abbe22cf6f 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) |