Fix exception-specification of std::invoke
* include/bits/invoke.h (__invoke): Fix exception-specification. * include/std/functional (invoke): Likewise. * testsuite/20_util/function_objects/invoke/1.cc: New test. From-SVN: r241089
This commit is contained in:
parent
92c5266bbd
commit
3e0c9334e9
4 changed files with 38 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2016-10-13 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
* include/bits/invoke.h (__invoke): Fix exception-specification.
|
||||
* include/std/functional (invoke): Likewise.
|
||||
* testsuite/20_util/function_objects/invoke/1.cc: New test.
|
||||
|
||||
2016-10-12 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* testsuite/util/testsuite_hooks.h: Rewrite VERIFY in terms of
|
||||
|
|
|
@ -87,7 +87,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Callable, typename... _Args>
|
||||
constexpr typename result_of<_Callable&&(_Args&&...)>::type
|
||||
__invoke(_Callable&& __fn, _Args&&... __args)
|
||||
noexcept(__is_nothrow_callable<_Callable(_Args&&...)>::value)
|
||||
noexcept(__is_nothrow_callable<_Callable&&(_Args&&...)>::value)
|
||||
{
|
||||
using __result_of = result_of<_Callable&&(_Args&&...)>;
|
||||
using __type = typename __result_of::type;
|
||||
|
|
|
@ -200,7 +200,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
template<typename _Callable, typename... _Args>
|
||||
inline result_of_t<_Callable&&(_Args&&...)>
|
||||
invoke(_Callable&& __fn, _Args&&... __args)
|
||||
noexcept(is_nothrow_callable_v<_Callable(_Args&&...)>)
|
||||
noexcept(is_nothrow_callable_v<_Callable&&(_Args&&...)>)
|
||||
{
|
||||
return std::__invoke(std::forward<_Callable>(__fn),
|
||||
std::forward<_Args>(__args)...);
|
||||
|
|
30
libstdc++-v3/testsuite/20_util/function_objects/invoke/1.cc
Normal file
30
libstdc++-v3/testsuite/20_util/function_objects/invoke/1.cc
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright (C) 2016 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
#include <functional>
|
||||
|
||||
struct abstract {
|
||||
virtual ~abstract() = 0;
|
||||
void operator()() noexcept;
|
||||
};
|
||||
|
||||
static_assert( noexcept(std::__invoke(std::declval<abstract>())), "" );
|
||||
#if __cpp_lib_invoke
|
||||
static_assert( noexcept(std::invoke(std::declval<abstract>())), "" );
|
||||
#endif
|
Loading…
Add table
Reference in a new issue