diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 05fc1bd41..93299685a 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 be3c27e34..fcdffac73 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 63c00cc46..c1d276e48 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 000000000..8013ef5c2 --- /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 }; +}