tr1::reference_wrapper<T>::operator()() should not dereference get() before calling the function object, because get() returns a reference (not a pointer).
Created attachment 10225 [details] Mainline (4.1.0) patch to test and fix this problem The fix is trivial. The changes to the test case cause failures that are fixed by the patch to ref_wrap_iterate.h. All of the tr1/3_function_objects tests still pass on i686-pc-linux-gnu. 2005-11-12 Douglas Gregor <doug.gregor@gmail.com> * include/tr1/ref_wrap_iterate.h (reference_wrapper::operator()()): Don't dereferene the result of get() before calling it; it's already a reference. * testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc: Test nullary calls to reference_wrappers.
Thanks a lot. I will take care of applying the patch asap.
Subject: Bug 24818 Author: paolo Date: Sun Nov 13 12:14:15 2005 New Revision: 106862 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106862 Log: 2005-11-13 Jonathan Wakely <redi@gcc.gnu.org> * include/tr1/boost_shared_ptr.h (get_deleter): Declare before shared_ptr. (shared_ptr<>): Declare get_deleter as friend. (shared_ptr<>:_M_get_deleter): Private. 2005-11-13 Douglas Gregor <doug.gregor@gmail.com> PR libstdc++/24818 * include/tr1/ref_wrap_iterate.h (reference_wrapper::operator()()): Don't dereferene the result of get() before calling it; it's already a reference. * testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc: Test nullary calls to reference_wrappers. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/tr1/ref_wrap_iterate.h trunk/libstdc++-v3/testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc
Subject: Bug 24818 Author: paolo Date: Sun Nov 13 12:14:51 2005 New Revision: 106863 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106863 Log: 2005-11-13 Jonathan Wakely <redi@gcc.gnu.org> * include/tr1/boost_shared_ptr.h (get_deleter): Declare before shared_ptr. (shared_ptr<>): Declare get_deleter as friend. (shared_ptr<>:_M_get_deleter): Private. 2005-11-13 Douglas Gregor <doug.gregor@gmail.com> PR libstdc++/24818 * include/tr1/ref_wrap_iterate.h (reference_wrapper::operator()()): Don't dereferene the result of get() before calling it; it's already a reference. * testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc: Test nullary calls to reference_wrappers. Modified: trunk/libstdc++-v3/include/tr1/boost_shared_ptr.h
Subject: Bug 24818 Author: paolo Date: Sun Nov 13 12:19:01 2005 New Revision: 106864 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106864 Log: 2005-11-13 Douglas Gregor <doug.gregor@gmail.com> PR libstdc++/24818 * include/tr1/ref_wrap_iterate.h (reference_wrapper::operator()()): Don't dereferene the result of get() before calling it; it's already a reference. * testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc: Test nullary calls to reference_wrappers. 2005-11-13 Paolo Carlini <pcarlini@suse.de> PR libstdc++/24799 * include/tr1/functional (hash): Inherit from std::unary_function. * testsuite/tr1/6_containers/unordered/hash/24799.cc: New. PR libstdc++/24805 * include/tr1/boost_shared_ptr.h (swap(shared_ptr<>&, shared_ptr<>&), swap(weak_ptr<>&, weak_ptr<>&)): Move inside namespace tr1. * testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/ 24805.cc: New. PR libstdc++/24809 * include/tr1/type_traits (__is_polymorhpic_helper): Adjust destructor. * testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/ 24809.cc: New. Added: branches/gcc-4_0-branch/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/24805.cc branches/gcc-4_0-branch/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/24809.cc branches/gcc-4_0-branch/libstdc++-v3/testsuite/tr1/6_containers/unordered/hash/ branches/gcc-4_0-branch/libstdc++-v3/testsuite/tr1/6_containers/unordered/hash/24799.cc Modified: branches/gcc-4_0-branch/libstdc++-v3/ChangeLog branches/gcc-4_0-branch/libstdc++-v3/include/tr1/boost_shared_ptr.h branches/gcc-4_0-branch/libstdc++-v3/include/tr1/functional branches/gcc-4_0-branch/libstdc++-v3/include/tr1/ref_wrap_iterate.h branches/gcc-4_0-branch/libstdc++-v3/include/tr1/type_traits branches/gcc-4_0-branch/libstdc++-v3/testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc
Fixed for 4.0.3.