From 251a1f02a0ae7eb93690dd0daad8575a3c0451b3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 6 Apr 2014 10:38:50 +0200 Subject: Features: Add cxx_local_type_template_args. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + .../cxx_local_type_template_args.cpp | 21 +++++++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_local_type_template_args.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index fab8535..1a76a3b 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -117,6 +117,11 @@ The features known to this version of CMake are: .. _N2927: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2927.pdf +``cxx_local_type_template_args`` + Local and unnamed types as template arguments, as defined in N2657_. + + .. _N2657: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm + ``cxx_noexcept`` Exception specifications, as defined in N3050_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 506d718..586ab4b 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -38,6 +38,7 @@ set(_cmake_feature_test_cxx_unrestricted_unions "${GNU46_CXX11}") set(GNU45_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}") set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}") +set(_cmake_feature_test_cxx_local_type_template_args "${GNU45_CXX11}") set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}") # TODO: Should be supported by GNU 4.4 set(GNU44_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f86a999..7b960a3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -63,6 +63,7 @@ F(cxx_inheriting_constructors) \ F(cxx_inline_namespaces) \ F(cxx_lambdas) \ + F(cxx_local_type_template_args) \ F(cxx_noexcept) \ F(cxx_nonstatic_member_init) \ F(cxx_nullptr) \ diff --git a/Tests/CompileFeatures/cxx_local_type_template_args.cpp b/Tests/CompileFeatures/cxx_local_type_template_args.cpp new file mode 100644 index 0000000..802ea7a --- /dev/null +++ b/Tests/CompileFeatures/cxx_local_type_template_args.cpp @@ -0,0 +1,21 @@ + +template +class X { }; +template +void f(T t) { } +struct {} unnamed_obj; +void f() { + struct A { }; + enum { e1 }; + typedef struct {} B; + B b; + X x1; + X x2; + X x3; + f(e1); + f(unnamed_obj); + f(b); + (void)x1; + (void)x2; + (void)x3; +} -- cgit v0.12