From 1ebb0d79fe1330eea4b044bcfd9b613db8bfe86b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 7 May 2019 13:20:21 -0400 Subject: CompileFeatures: Relax cxx_relaxed_constexpr compiler requirements This in effect means that cxx_relaxed_constexpr is now supported by MSVC and Intel 18.0-18.04. --- Modules/Compiler/Intel-CXX-FeatureTests.cmake | 2 +- Modules/Compiler/MSVC-CXX-FeatureTests.cmake | 6 ++---- Tests/CompileFeatures/cxx_relaxed_constexpr.cpp | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake index aa35b97..bbefe15 100644 --- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake @@ -24,7 +24,7 @@ set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !def unset(DETECT_BUGGY_ICC15) set(Intel17_CXX14 "__INTEL_COMPILER >= 1700 && ${DETECT_CXX14}") -set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && !(__INTEL_COMPILER == 1800 && __INTEL_COMPILER_UPDATE < 5) && !defined(_MSC_VER))") +set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && !defined(_MSC_VER))") set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}") set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}") diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake index 9c604f2..125974a 100644 --- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake +++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake @@ -9,10 +9,8 @@ set(_cmake_oldestSupported "_MSC_VER >= 1600") # https://docs.microsoft.com/en-us/cpp/cpp-conformance-improvements-2017#update_153 set(_cmake_feature_test_cxx_decltype_incomplete_return_types "_MSC_VER >= 1911") -set(MSVC_2017 "_MSC_VER >= 1910") -# VS 2017 introduces support for "N3652 Extended constexpr" -# but as of v15.6 there are still bugs in the implementation -#set(_cmake_feature_test_cxx_relaxed_constexpr "${MSVC_2017}") +# VS 2017 v15.3 fixes support for "N3652 Extended constexpr" +set(_cmake_feature_test_cxx_relaxed_constexpr "_MSC_VER >= 1911") # VS 2017 Preview introduces support for aggregate initializers. set(_cmake_feature_test_cxx_aggregate_default_initializers "_MSC_FULL_VER >= 190024406") diff --git a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp index 7b3602c..953148d 100644 --- a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp +++ b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp @@ -22,6 +22,7 @@ constexpr int g(const int (&is)[4]) int someFunc() { - constexpr int k3 = g({ 4, 5, 6, 7 }); + constexpr int values[4] = { 4, 5, 6, 7 }; + constexpr int k3 = g(values); return k3 - 42; } -- cgit v0.12 From 62dbe53a8a2809c0c38386e5880acb446feacf28 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 9 May 2019 10:55:55 -0400 Subject: CompileFeatures: Record when Intel gained full CXX14 support Use the infrastructure added by commit 646fb1a646 (CompileFeatures: memoize C++ compilers with full language level support, 2019-03-27) to avoid using a `try_compile` to check for C++14 feature support when the running compiler is known to have all features. --- Modules/Compiler/Intel-CXX.cmake | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 44b0c3d..b630a6b 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -40,13 +40,7 @@ else() set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") endif() - # While full C++14 support was first introduced in Intel 17, - # Intel 18.0.0-4 don't have full support as they broke - # support for cxx_relaxed_constexpr. - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18.0.4) - set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) - elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0.0 - AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0) set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif() -- cgit v0.12 From d156f8f5a2702aa64b74fa01f48b38c7078054d1 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 7 May 2019 13:26:34 -0400 Subject: CompileFeatures: Record when MSVC gained full CXX14 support Use the infrastructure added by commit 646fb1a646 (CompileFeatures: memoize C++ compilers with full language level support, 2019-03-27) to avoid using a `try_compile` to check for C++14 feature support when the running compiler is known to have all features. --- Modules/Compiler/MSVC-CXX.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 787c17e..f3a7408 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -18,6 +18,7 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11.25505) set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++17") else() -- cgit v0.12