diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 97689dcb2..bf91fbc52 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -27,6 +27,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_defaulted_functions`` + Defaulted functions, as defined in N2346_. + + .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm + ``cxx_delegating_constructors`` Delegating constructors, as defined in N1986_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index de328c438..7d3c13bdf 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -18,6 +18,7 @@ set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}") # TODO: Should be supported by GNU 4.4 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_strong_enums "${GNU44_CXX11}") set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}") set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6ce3c16b1..c7c98aab5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -45,6 +45,7 @@ F(cxx_auto_type) \ F(cxx_constexpr) \ F(cxx_decltype) \ + F(cxx_defaulted_functions) \ F(cxx_delegating_constructors) \ F(cxx_final) \ F(cxx_override) \ diff --git a/Tests/CompileFeatures/cxx_defaulted_functions.cpp b/Tests/CompileFeatures/cxx_defaulted_functions.cpp new file mode 100644 index 000000000..b679a9269 --- /dev/null +++ b/Tests/CompileFeatures/cxx_defaulted_functions.cpp @@ -0,0 +1,9 @@ + +struct A { + A() = default; +}; + +void someFunc() +{ + A a; +}