From 750dfee29c3f45020e8fcff91499a2542913b649 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 7 Apr 2014 17:28:55 +0200 Subject: Features: Add cxx_delegating_constructors. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 3 +++ Source/cmMakefile.cxx | 3 ++- Tests/CompileFeatures/cxx_delegating_constructors.cpp | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Tests/CompileFeatures/cxx_delegating_constructors.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 3278b2e..957c763 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -16,3 +16,8 @@ The features known to this version of CMake are: Automatic type deduction, as defined in N1984_. .. _N1984: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf + +``cxx_delegating_constructors`` + Delegating constructors, as defined in N1986_. + + .. _N1986: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index b36315f..4f14b17 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -2,6 +2,9 @@ # Reference: http://gcc.gnu.org/projects/cxx0x.html set(_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408") +# TODO: Should be supported by GNU 4.7 +set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_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 5004a08..de6b972 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -42,7 +42,8 @@ #include #define FOR_EACH_CXX_FEATURE(F) \ - F(cxx_auto_type) + F(cxx_auto_type) \ + F(cxx_delegating_constructors) class cmMakefile::Internals { diff --git a/Tests/CompileFeatures/cxx_delegating_constructors.cpp b/Tests/CompileFeatures/cxx_delegating_constructors.cpp new file mode 100644 index 0000000..4b41615 --- /dev/null +++ b/Tests/CompileFeatures/cxx_delegating_constructors.cpp @@ -0,0 +1,15 @@ + +class Foo +{ +public: + Foo(int i); + + Foo(double d) + : Foo(static_cast(d)) + { + + } + +private: + int m_i; +}; -- cgit v0.12