From adf22f611e2e4213df31cc7e1d8c1513847b72ff Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 6 Apr 2014 10:41:01 +0200 Subject: [PATCH] Features: Add cxx_default_function_template_args. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + .../cxx_default_function_template_args.cpp | 12 ++++++++++++ 4 files changed, 19 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_default_function_template_args.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 710fdcfd6..1f9cbbdc4 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -52,6 +52,11 @@ The features known to this version of CMake are: .. _N2343: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf +``cxx_default_function_template_args`` + Default template arguments for function templates, as defined in DR226_ + + .. _DR226: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 + ``cxx_defaulted_functions`` Defaulted functions, as defined in N2346_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index be6fed4b1..94a31c886 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -60,6 +60,7 @@ set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}") # TODO: Should be supported by GNU 4.3 set(GNU43_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}") +set(_cmake_feature_test_cxx_default_function_template_args "${GNU43_CXX11}") set(_cmake_feature_test_cxx_right_angle_brackets "${GNU43_CXX11}") set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}") set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 61549ae2f..577aa3771 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -50,6 +50,7 @@ F(cxx_constexpr) \ F(cxx_decltype) \ F(cxx_decltype_incomplete_return_types) \ + F(cxx_default_function_template_args) \ F(cxx_defaulted_functions) \ F(cxx_delegating_constructors) \ F(cxx_deleted_functions) \ diff --git a/Tests/CompileFeatures/cxx_default_function_template_args.cpp b/Tests/CompileFeatures/cxx_default_function_template_args.cpp new file mode 100644 index 000000000..3d14c52ca --- /dev/null +++ b/Tests/CompileFeatures/cxx_default_function_template_args.cpp @@ -0,0 +1,12 @@ + +template +int someFunc() +{ + T t = 0; + return t; +} + +void otherFunc() +{ + someFunc(); +}