Просмотр исходного кода

Features: Add cxx_inheriting_constructors.

Stephen Kelly 11 лет назад
Родитель
Сommit
a579a0aab4

+ 5 - 0
Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst

@@ -52,6 +52,11 @@ The features known to this version of CMake are:
 
 
   .. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
   .. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
 
 
+``cxx_inheriting_constructors``
+  Inheriting constructors, as defined in N2540_.
+
+  .. _N2540: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm
+
 ``cxx_override``
 ``cxx_override``
   Override control ``override`` keyword, as defined in N2928_.
   Override control ``override`` keyword, as defined in N2928_.
 
 

+ 2 - 0
Modules/Compiler/GNU-CXX-FeatureTests.cmake

@@ -2,6 +2,8 @@
 # Reference: http://gcc.gnu.org/projects/cxx0x.html
 # Reference: http://gcc.gnu.org/projects/cxx0x.html
 
 
 set(_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408")
 set(_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408")
+set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}")
 # TODO: Should be supported by GNU 4.7
 # TODO: Should be supported by GNU 4.7
 set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
 set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
 set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
 set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")

+ 1 - 0
Source/cmMakefile.cxx

@@ -50,6 +50,7 @@
   F(cxx_deleted_functions) \
   F(cxx_deleted_functions) \
   F(cxx_explicit_conversions) \
   F(cxx_explicit_conversions) \
   F(cxx_final) \
   F(cxx_final) \
+  F(cxx_inheriting_constructors) \
   F(cxx_override) \
   F(cxx_override) \
   F(cxx_static_assert) \
   F(cxx_static_assert) \
   F(cxx_strong_enums) \
   F(cxx_strong_enums) \

+ 18 - 0
Tests/CompileFeatures/cxx_inheriting_constructors.cpp

@@ -0,0 +1,18 @@
+
+struct A
+{
+  int m_i;
+
+  A(int i) : m_i(i) {}
+};
+
+struct B : public A
+{
+  using A::A;
+};
+
+void someFunc()
+{
+  int i;
+  B b(i);
+}