diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 5ac646c0e..fab8535d6 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -82,6 +82,11 @@ The features known to this version of CMake are: .. _N2437: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf +``cxx_extended_friend_declarations`` + Extended friend declarations, as defined in N1791_. + + .. _N1791: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf + ``cxx_extern_templates`` Extern templates, as defined in N1987_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index d1bd4a047..506d7180f 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -16,6 +16,7 @@ set(_cmake_feature_test_cxx_thread_local "${GNU48_CXX11}") set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}") set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}") +set(_cmake_feature_test_cxx_extended_friend_declarations "${GNU47_CXX11}") set(_cmake_feature_test_cxx_final "${GNU47_CXX11}") set(_cmake_feature_test_cxx_noexcept "${GNU47_CXX11}") set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c5ec8178..f86a999e7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -56,6 +56,7 @@ F(cxx_deleted_functions) \ F(cxx_enum_forward_declarations) \ F(cxx_explicit_conversions) \ + F(cxx_extended_friend_declarations) \ F(cxx_extern_templates) \ F(cxx_final) \ F(cxx_generalized_initializers) \ diff --git a/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp b/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp new file mode 100644 index 000000000..631c699a9 --- /dev/null +++ b/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp @@ -0,0 +1,25 @@ + +template +struct B +{ + B() : m_i(42) {} +private: + int m_i; + friend T; +}; + +struct A +{ + template + int getBValue(B b) + { + return b.m_i; + } +}; + +void someFunc() +{ + A a; + B b; + a.getBValue(b); +}