From e1e292cd069bf811b0635088539aace0f0eeaf68 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 4 Apr 2014 10:50:41 +0200 Subject: [PATCH] Features: Add cxx_alias_templates. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_alias_templates.cpp | 11 +++++++++++ 4 files changed, 18 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_alias_templates.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index bdcd46bbe..fbc45c2e6 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/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_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 5bf3420d1..5f8d95231 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/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}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d632db6bd..fc89d8e7c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -42,6 +42,7 @@ #include #define FOR_EACH_CXX_FEATURE(F) \ + F(cxx_alias_templates) \ F(cxx_auto_type) \ F(cxx_constexpr) \ F(cxx_decltype) \ diff --git a/Tests/CompileFeatures/cxx_alias_templates.cpp b/Tests/CompileFeatures/cxx_alias_templates.cpp new file mode 100644 index 000000000..a47e27ded --- /dev/null +++ b/Tests/CompileFeatures/cxx_alias_templates.cpp @@ -0,0 +1,11 @@ + +template +struct A +{ + typedef T1 MyT1; + using MyT2 = T2; +}; + +using B = A; +template +using C = A;