diff options
-rw-r--r-- | Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 | ||||
-rw-r--r-- | Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 1 | ||||
-rw-r--r-- | Tests/CompileFeatures/cxx_extended_friend_declarations.cpp | 25 |
4 files changed, 32 insertions, 0 deletions
diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 5ac646c..fab8535 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 d1bd4a0..506d718 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 7c5ec81..f86a999 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 0000000..631c699 --- /dev/null +++ b/Tests/CompileFeatures/cxx_extended_friend_declarations.cpp @@ -0,0 +1,25 @@ + +template <typename T> +struct B +{ + B() : m_i(42) {} +private: + int m_i; + friend T; +}; + +struct A +{ + template<typename T> + int getBValue(B<T> b) + { + return b.m_i; + } +}; + +void someFunc() +{ + A a; + B<A> b; + a.getBValue(b); +} |