From e74b216c90d33548e7b248276346a5d00eff5ee3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 4 Apr 2014 14:52:48 +0200 Subject: Features: Add cxx_generalized_initializers. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + .../cxx_generalized_initializers.cpp | 23 ++++++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_generalized_initializers.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 05fc1bd..9329968 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -77,6 +77,11 @@ The features known to this version of CMake are: .. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm +``cxx_generalized_initializers`` + Initializer lists, as defined in N2672_. + + .. _N2672: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm + ``cxx_inheriting_constructors`` Inheriting constructors, as defined in N2540_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index be3c27e..fcdffac 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -40,6 +40,7 @@ set(GNU44_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}") set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}") set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}") +set(_cmake_feature_test_cxx_generalized_initializers "${GNU44_CXX11}") set(_cmake_feature_test_cxx_strong_enums "${GNU44_CXX11}") set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}") set(_cmake_feature_test_cxx_unicode_literals "${GNU44_CXX11}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 63c00cc..c1d276e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -55,6 +55,7 @@ F(cxx_explicit_conversions) \ F(cxx_extern_templates) \ F(cxx_final) \ + F(cxx_generalized_initializers) \ F(cxx_inheriting_constructors) \ F(cxx_lambdas) \ F(cxx_noexcept) \ diff --git a/Tests/CompileFeatures/cxx_generalized_initializers.cpp b/Tests/CompileFeatures/cxx_generalized_initializers.cpp new file mode 100644 index 0000000..8013ef5 --- /dev/null +++ b/Tests/CompileFeatures/cxx_generalized_initializers.cpp @@ -0,0 +1,23 @@ + +// Dummy implementation. Test only the compiler feature. +namespace std { + typedef decltype(sizeof(int)) size_t; + template + class initializer_list + { + const _E* __begin_; + size_t __size_; + + }; +} + +template +struct A +{ + A(std::initializer_list) {} +}; + +void someFunc() +{ + A as = { 1, 2, 3, 4 }; +} -- cgit v0.12