aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-08-15 17:07:27 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-08-15 17:07:27 +0100
commitd91f618d155a418acd7a7c9188af4c15d2583541 (patch)
treea3ac6876d78bb1d763c7c097b3f26a93f64d7a3d /gcc/fortran/interface.c
parentb3595983e39ba69fb8393d5bea26289b86a27483 (diff)
downloadgcc-d91f618d155a418acd7a7c9188af4c15d2583541.zip
gcc-d91f618d155a418acd7a7c9188af4c15d2583541.tar.gz
gcc-d91f618d155a418acd7a7c9188af4c15d2583541.tar.bz2
PR libstdc++/91456 make INVOKE<R> work with uncopyable prvalues
In C++17 a function can return a prvalue of a type that cannot be moved or copied. The current implementation of std::is_invocable_r uses std::is_convertible to test the conversion to R required by INVOKE<R>. That fails for non-copyable prvalues, because std::is_convertible is defined in terms of std::declval which uses std::add_rvalue_reference. In C++17 conversion from R to R involves no copies and so is not the same as conversion from R&& to R. This commit changes std::is_invocable_r to check the conversion without using std::is_convertible. std::function also contains a similar check using std::is_convertible, which can be fixed by simply reusing std::is_invocable_r (but because std::is_invocable_r is not defined for C++11 it uses the underlying std::__is_invocable_impl trait directly). PR libstdc++/91456 * include/bits/std_function.h (__check_func_return_type): Remove. (function::_Callable): Use std::__is_invocable_impl instead of __check_func_return_type. * include/std/type_traits (__is_invocable_impl): Add another defaulted template parameter. Define a separate partial specialization for INVOKE and INVOKE<void>. For INVOKE<R> replace is_convertible check with a check that models delayed temporary materialization. * testsuite/20_util/function/91456.cc: New test. * testsuite/20_util/is_invocable/91456.cc: New test. From-SVN: r274542
Diffstat (limited to 'gcc/fortran/interface.c')
0 files changed, 0 insertions, 0 deletions