[Bug libstdc++/79798] [7 Regression] std::bind loses cv-qualifiers in result_of type

2017-03-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79798

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Jonathan Wakely  ---
Fixed

[Bug libstdc++/79798] [7 Regression] std::bind loses cv-qualifiers in result_of type

2017-03-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79798

--- Comment #2 from Jonathan Wakely  ---
Author: redi
Date: Thu Mar  2 03:43:36 2017
New Revision: 245827

URL: https://gcc.gnu.org/viewcvs?rev=245827=gcc=rev
Log:
PR 79798 Fix incorrect use of std::result_of in std::bind

PR libstdc++/79798
* include/std/functional (bind::_Res_type_impl): Fix incorrect use of
result_of that loses top-level cv-qualifiers.
* testsuite/20_util/bind/79798.cc: New test.

Added:
trunk/libstdc++-v3/testsuite/20_util/bind/79798.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/functional

[Bug libstdc++/79798] [7 Regression] std::bind loses cv-qualifiers in result_of type

2017-03-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79798

--- Comment #1 from Jonathan Wakely  ---
We need to add && to the arg types in the result_of argument, so that top-level
cv qualifiers aren't lost in the function type that result_of requires us to
use:

--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -502,7 +502,7 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type)

   template
using _Res_type_impl
- = typename result_of< _Fn&(_Mu_type<_BArgs, _CallArgs>...) >::type;
+ = typename result_of< _Fn&(_Mu_type<_BArgs, _CallArgs>&&...) >::type;

   template
using _Res_type = _Res_type_impl<_Functor, _CallArgs, _Bound_args...>;

This would be fixed by adopting the proposed invoke_result and using that
instead of result_of, which we've agreed to deprecate.