[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 Jonathan Wakely changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |7.0 --- Comment #7 from Jonathan Wakely --- Fixed for gcc 7.
[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 --- Comment #6 from Jonathan Wakely --- Author: redi Date: Thu Jan 12 14:28:38 2017 New Revision: 244364 URL: https://gcc.gnu.org/viewcvs?rev=244364=gcc=rev Log: PR66284 remove std::function special case for reference_wrapper PR libstdc++/66284 * doc/xml/manual/intro.xml: Document LWG 2781 change. * doc/html/*: Regenerate. * include/std/functional (_Function_base::_Ref_manager): Remove. (_Function_handler): Remove partial specializations for reference_wrapper. (function::target): Remove special case for const qualification. * testsuite/20_util/function/6.cc: Adjust tests for target type. * testsuite/20_util/function/7.cc: Likewise. * testsuite/20_util/function/8.cc: Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/doc/html/manual/bugs.html trunk/libstdc++-v3/doc/html/manual/documentation_hacking.html trunk/libstdc++-v3/doc/xml/manual/intro.xml trunk/libstdc++-v3/include/bits/std_function.h trunk/libstdc++-v3/testsuite/20_util/function/6.cc trunk/libstdc++-v3/testsuite/20_util/function/7.cc trunk/libstdc++-v3/testsuite/20_util/function/8.cc
[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 --- Comment #5 from Jonathan Wakely --- https://wg21.link/lwg2781
[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 --- Comment #4 from Jonathan Wakely --- Created attachment 39806 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39806=edit Patch to remove special-case for reference_wrapper. This patch makes it work as desired. We need to fix 3-4 test cases too which explicitly check for the current behaviour (it's by design, matching Boost.Function). I submitted a defect report, with a proposed change to make the copy + move constructors say "if f’s target is a callable object passed viaspecialization of reference_wrapper or a function pointer."
[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 --- Comment #3 from David Krauss --- … Woops, that f is the function parameter, not the target. So it's not a conflicting requirement, but it could be a template for fixing the the copy constructor constraint.
[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 --- Comment #2 from David Krauss --- The converting constructor requirements also say more explicitly, shall not throw exceptions when f is a function pointer or a reference_wrapper for some T. Probably the copy constructor should be worded similarly. In any case, the exception guarantee isn't affected, as sizeof(reference_wrapper) == sizeof(T*).
[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 --- Comment #1 from Jonathan Wakely --- (In reply to David Krauss from comment #0) > This is not conforming. Hmm, I think that's debatable. [func.wrap.func.con] says: Throws: shall not throw exceptions if f’s target is a callable object passed via reference_wrapper or a function pointer. By your interpretation, it is impossible for the target to be a callable object passed by reference_wrapper, because the target will be the reference_wrapper itself. This wording seems to imply that when the function(F) constructor is passed a reference_wrapper the target should be the wrapped T. However, the function(F) constructor doesn't say anything like that, it says "*this targets a copy of f". So I'm tempted to say this is a defect in the standard. The copy constructor is trying to be helpful, and say it won't throw under certain conditions, but it does so confusingly.
[Bug libstdc++/66284] std::reference_wrapper is transparent to std::function::target_type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66284 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-01-08 Ever confirmed|0 |1 Severity|normal |minor