r271171 - in /trunk/libstdc++-v3: ChangeLog inc...
redi@gcc.gnu.org
redi@gcc.gnu.org
Tue May 14 14:39:00 GMT 2019
Author: redi
Date: Tue May 14 14:39:58 2019
New Revision: 271171
URL: https://gcc.gnu.org/viewcvs?rev=271171&root=gcc&view=rev
Log:
Add __is_nothrow_convertible to fix std::is_nothrow_invocable_r
The definition of is_nothrow_invocable in terms of is_convertible and
is_nothrow_constructible is incorrect, because a type could have an
explicit constructor that means is_nothrow_constructible is true, but
implicit conversions could use a different constructor that is
potentially-throwing.
Fix it by adding a C++11 version of C++20's is_nothrow_convertible that
only considers implicit conversions.
* include/std/type_traits (__is_nt_convertible_helper): Define it
unconditionally, not only for C++20.
(__is_nothrow_convertible): Define internal trait for use in C++11.
(__is_nt_invocable_impl: Fix by using __is_nothrow_convertible.
(is_invocable_r_v, is_nothrow_invocable_r_v): Add missing parameter.
* testsuite/20_util/is_nothrow_convertible/value_ext.cc: New test.
* testsuite/20_util/is_nothrow_convertible/value.cc: Check with type
that has nothrow explicit conversion but potentially-throwing implicit
conversion.
* testsuite/20_util/is_nothrow_invocable/value.cc: Likewise.
* testsuite/20_util/is_nothrow_invocable/value_ext.cc: Fix helper
function to only consider implicit conversions.
* testsuite/20_util/tuple/cons/noexcept_specs.cc: Add comment.
Added:
trunk/libstdc++-v3/testsuite/20_util/is_nothrow_convertible/value_ext.cc
- copied, changed from r271169, trunk/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/type_traits
trunk/libstdc++-v3/testsuite/20_util/is_nothrow_convertible/value.cc
trunk/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value.cc
trunk/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/value_ext.cc
trunk/libstdc++-v3/testsuite/20_util/tuple/cons/noexcept_specs.cc
More information about the Libstdc++-cvs
mailing list