summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-04-07 15:28:55 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-08 09:05:54 (GMT)
commit750dfee29c3f45020e8fcff91499a2542913b649 (patch)
treeebe197a7b03dd37cf8e2af31c16a57772a259a70
parent9eaf3755987821080908a289cefbf546773071f9 (diff)
downloadCMake-750dfee29c3f45020e8fcff91499a2542913b649.zip
CMake-750dfee29c3f45020e8fcff91499a2542913b649.tar.gz
CMake-750dfee29c3f45020e8fcff91499a2542913b649.tar.bz2
Features: Add cxx_delegating_constructors.
-rw-r--r--Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst5
-rw-r--r--Modules/Compiler/GNU-CXX-FeatureTests.cmake3
-rw-r--r--Source/cmMakefile.cxx3
-rw-r--r--Tests/CompileFeatures/cxx_delegating_constructors.cpp15
4 files changed, 25 insertions, 1 deletions
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 <assert.h>
#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<int>(d))
+ {
+
+ }
+
+private:
+ int m_i;
+};