[v3] fix libstdc++/48521
Jonathan Wakely
jwakely.gcc@gmail.com
Tue Apr 19 13:26:00 GMT 2011
2011-04-19 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/48521
* include/std/type_traits (result_of): Handle pointer to member.
* include/std/functional (__invoke): Likewise.
(_Function_to_function_pointer): Remove.
(_Reference_wrapper_base): Provide nested types independent of
unary_function and binary_function.
(reference_wrapper::operator()): DR 2017.
(ref(const A&&), cref(const A&&): Define as deleted.
* include/std/future (async): Simplify SFINAE and use result_of to
support pointer to member.
* testsuite/20_util/reference_wrapper/invoke.cc: Test pointer to
member.
* testsuite/20_util/reference_wrapper/24803.cc: Likewise.
* testsuite/20_util/reference_wrapper/typedefs.cc: Test for types
instead of derivation from unary_function and binary_function.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
* testsuite/20_util/reference_wrapper/invoke-2.cc: New.
* testsuite/20_util/reference_wrapper/ref_neg.c: New.
* testsuite/20_util/reference_wrapper/typedefs-3.c: New.
This resolves a few issues in <functional> which I first noticed
because our std::async didn't work with pointers to member. To fix
that I needed to make result_of support pointer to member, then use
result_of in async, which required changing the enable_if otherwise we
form an invalid result_of expression outside the immediate context of
the type deduction, where SFINAE doesn't apply.
I implemented DR 2017 (reference wrapper makes incorrect use of
result_of) and because we now use a reference to the wrapped type in
the result_of expression we don't need Function_to_function_pointer to
prevent forming an invalid expression.
I made reference_wrapper define the nested
{first_,second_,}argument_type typedefs correctly if the wrapped type
defines them. Previously we only did so if the nested type derived
from {unary,binary}_function but the C++0x draft was changed to stop
depending on those types.
Finally, I've also added missing ref/cref overloads to prevent
creating reference_wrapper to rvalues.
mem_fn doesn't yet support varargs member functions, I'll fix that
when PR c++/48424 is fixed.
Tested x86_64-linux, committed to trunk. Will wait a day or two and
commit to 4.6 too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 48521.diff
Type: text/x-patch
Size: 27429 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20110419/76ffa4ef/attachment.bin>
More information about the Libstdc++
mailing list