From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 30A55385842B; Wed, 24 Nov 2021 11:51:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30A55385842B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-9290] libstdc++: Name std::function template parameter X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: e51106b013fe757ad5b3d3413df07fd4b28418bd X-Git-Newrev: 5709564895f38d7d1f76e6298514ed242f676bb8 Message-Id: <20211124115123.30A55385842B@sourceware.org> Date: Wed, 24 Nov 2021 11:51:23 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2021 11:51:23 -0000 https://gcc.gnu.org/g:5709564895f38d7d1f76e6298514ed242f676bb8 commit r11-9290-g5709564895f38d7d1f76e6298514ed242f676bb8 Author: Jonathan Wakely Date: Fri Aug 27 00:20:31 2021 +0100 libstdc++: Name std::function template parameter This avoids "" being shown in the diagnostics for ill-formed uses of std::function constructor: In instantiation of 'std::function<_Res(_ArgTypes ...)>::function(_Functor&&) [with _Functor = f(f()::_Z1fv.frame*)::; = void; _Res = void; _ArgTypes = {}]' Instead we get: In instantiation of 'std::function<_Res(_ArgTypes ...)>::function(_Functor&&) [with _Functor = f(f()::_Z1fv.frame*)::; _Constraints = void; _Res = void; _ArgTypes = {}]' Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/std_function.h (function::function(F&&)): Give name to defaulted template parameter, to improve diagnostics. Use markdown for more doxygen comments. (cherry picked from commit 952095bb053cfef47b48cc4345d658b8d8829800) Diff: --- libstdc++-v3/include/bits/std_function.h | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/libstdc++-v3/include/bits/std_function.h b/libstdc++-v3/include/bits/std_function.h index 8dfbd11f71e..f58d732430d 100644 --- a/libstdc++-v3/include/bits/std_function.h +++ b/libstdc++-v3/include/bits/std_function.h @@ -326,10 +326,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /** - * @brief Primary class template for std::function. + * @brief Polymorphic function wrapper. * @ingroup functors - * - * Polymorphic function wrapper. + * @since C++11 */ template class function<_Res(_ArgTypes...)> @@ -364,7 +363,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Default construct creates an empty function call wrapper. - * @post @c !(bool)*this + * @post `!(bool)*this` */ function() noexcept : _Function_base() { } @@ -379,10 +378,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief %Function copy constructor. * @param __x A %function object with identical call signature. - * @post @c bool(*this) == bool(__x) + * @post `bool(*this) == bool(__x)` * - * The newly-created %function contains a copy of the target of @a - * __x (if it has one). + * The newly-created %function contains a copy of the target of + * `__x` (if it has one). */ function(const function& __x) : _Function_base() @@ -399,7 +398,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @brief %Function move constructor. * @param __x A %function object rvalue with identical call signature. * - * The newly-created %function contains the target of @a __x + * The newly-created %function contains the target of `__x` * (if it has one). */ function(function&& __x) noexcept @@ -418,22 +417,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @brief Builds a %function that targets a copy of the incoming * function object. * @param __f A %function object that is callable with parameters of - * type @c T1, @c T2, ..., @c TN and returns a value convertible - * to @c Res. + * type `ArgTypes...` and returns a value convertible to `Res`. * * The newly-created %function object will target a copy of - * @a __f. If @a __f is @c reference_wrapper, then this function - * object will contain a reference to the function object @c - * __f.get(). If @a __f is a NULL function pointer or NULL - * pointer-to-member, the newly-created object will be empty. + * `__f`. If `__f` is `reference_wrapper`, then this function + * object will contain a reference to the function object `__f.get()`. + * If `__f` is a null function pointer, null pointer-to-member, or + * empty `std::function`, the newly-created object will be empty. * - * If @a __f is a non-NULL function pointer or an object of type @c - * reference_wrapper, this function will not throw. + * If `__f` is a non-null function pointer or an object of type + * `reference_wrapper`, this function will not throw. */ // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2774. std::function construction vs assignment template>> + typename _Constraints = _Requires<_Callable<_Functor>>> function(_Functor&& __f) noexcept(_Handler<_Functor>::template _S_nothrow_init<_Functor>()) : _Function_base()