Browse Source

Features: Add cxx_delegating_constructors.

Stephen Kelly 11 years ago
parent
commit
750dfee29c

+ 5 - 0
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

+ 3 - 0
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}")

+ 2 - 1
Source/cmMakefile.cxx

@@ -42,7 +42,8 @@
 #include <assert.h>
 
 #define FOR_EACH_CXX_FEATURE(F) \
-  F(cxx_auto_type)
+  F(cxx_auto_type) \
+  F(cxx_delegating_constructors)
 
 class cmMakefile::Internals
 {

+ 15 - 0
Tests/CompileFeatures/cxx_delegating_constructors.cpp

@@ -0,0 +1,15 @@
+
+class Foo
+{
+public:
+  Foo(int i);
+
+  Foo(double d)
+    : Foo(static_cast<int>(d))
+  {
+
+  }
+
+private:
+  int m_i;
+};