Browse Source

Features: Add cxx_alias_templates.

Stephen Kelly 11 years ago
parent
commit
e1e292cd06

+ 5 - 0
Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst

@@ -12,6 +12,11 @@ command.
 
 The features known to this version of CMake are:
 
+``cxx_alias_templates``
+  Template aliases, as defined in N2258_.
+
+  .. _N2258: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
+
 ``cxx_auto_type``
   Automatic type deduction, as defined in N1984_.
 

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

@@ -9,6 +9,7 @@ set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 2011
 set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}")
 # TODO: Should be supported by GNU 4.7
 set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}")
 set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
 set(_cmake_feature_test_cxx_final "${GNU47_CXX11}")
 set(_cmake_feature_test_cxx_noexcept "${GNU47_CXX11}")

+ 1 - 0
Source/cmMakefile.cxx

@@ -42,6 +42,7 @@
 #include <assert.h>
 
 #define FOR_EACH_CXX_FEATURE(F) \
+  F(cxx_alias_templates) \
   F(cxx_auto_type) \
   F(cxx_constexpr) \
   F(cxx_decltype) \

+ 11 - 0
Tests/CompileFeatures/cxx_alias_templates.cpp

@@ -0,0 +1,11 @@
+
+template <typename T1, typename T2>
+struct A
+{
+  typedef T1 MyT1;
+  using MyT2 = T2;
+};
+
+using B = A<int, char>;
+template<typename T>
+using C = A<int, T>;