From ebab2015f9b9b11f09e19369be7a1c8d3bfe3ae4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 3 Apr 2014 19:12:26 +0200 Subject: Features: Add cxx_explicit_conversions. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 3 +++ Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_explicit_conversions.cpp | 10 ++++++++++ 4 files changed, 19 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_explicit_conversions.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index df80abf..33e95b5 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -42,6 +42,11 @@ The features known to this version of CMake are: .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm +``cxx_explicit_conversions`` + Explicit conversion operators, as defined in N2437_. + + .. _N2437: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf + ``cxx_final`` Override control ``final`` keyword, as defined in N2928_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index f01382f..30bb171 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -15,6 +15,9 @@ set(_cmake_feature_test_cxx_override "${GNU47_CXX11}") # TODO: Should be supported by GNU 4.6 set(GNU46_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}") +# TODO: Should be supported by GNU 4.5 +set(GNU45_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}") # TODO: Should be supported by GNU 4.4 set(GNU44_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 192171f..5c4f6ff 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -48,6 +48,7 @@ F(cxx_defaulted_functions) \ F(cxx_delegating_constructors) \ F(cxx_deleted_functions) \ + F(cxx_explicit_conversions) \ F(cxx_final) \ F(cxx_override) \ F(cxx_static_assert) \ diff --git a/Tests/CompileFeatures/cxx_explicit_conversions.cpp b/Tests/CompileFeatures/cxx_explicit_conversions.cpp new file mode 100644 index 0000000..0decdcd --- /dev/null +++ b/Tests/CompileFeatures/cxx_explicit_conversions.cpp @@ -0,0 +1,10 @@ + +class A +{ + int m_i; +public: + explicit operator bool() + { + return m_i != 0; + } +}; -- cgit v0.12