aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/tr1
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2012-11-14 23:33:01 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2012-11-14 23:33:01 +0000
commit99ace34a31c9d1220d10ac6f6089038976732df1 (patch)
tree61c548f3b9eeb6c0a2b15a23e063290fb69cd049 /libstdc++-v3/include/tr1
parent3aac5aad16e7e77dcd3885089c6b2566df29feb9 (diff)
downloadgcc-99ace34a31c9d1220d10ac6f6089038976732df1.zip
gcc-99ace34a31c9d1220d10ac6f6089038976732df1.tar.gz
gcc-99ace34a31c9d1220d10ac6f6089038976732df1.tar.bz2
re PR libstdc++/55320 (Invalid delete with throwing copy-c'tor passed to std::function)
PR libstdc++/55320 * include/std/functional (function::function(F)): Set _M_manager after operations that could throw. (_Function_base::_Ref_manager::_M_init_functor): Use addressof. * include/tr1/functional (_Function_base::_Ref_manager::_M_init_functor): Use addressof. (_Function_base::_Base_manager::_M_get_pointer): Likewise. * testsuite/20_util/function/cons/55320.cc: New. * testsuite/20_util/function/cons/addressof.cc: New. * testsuite/20_util/function/cons/callable.cc: Remove header. * testsuite/20_util/bind/ref_neg.cc: Adjust dg-error line numbers. * testsuite/tr1/3_function_objects/function/10.cc: New. From-SVN: r193514
Diffstat (limited to 'libstdc++-v3/include/tr1')
-rw-r--r--libstdc++-v3/include/tr1/functional5
1 files changed, 2 insertions, 3 deletions
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index 88a8149..61d6455 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -1615,7 +1615,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_get_pointer(const _Any_data& __source)
{
const _Functor* __ptr =
- __stored_locally? &__source._M_access<_Functor>()
+ __stored_locally? std::__addressof(__source._M_access<_Functor>())
/* have stored a pointer */ : __source._M_access<_Functor*>();
return const_cast<_Functor*>(__ptr);
}
@@ -1744,8 +1744,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static void
_M_init_functor(_Any_data& __functor, reference_wrapper<_Functor> __f)
{
- // TBD: Use address_of function instead.
- _Base::_M_init_functor(__functor, &__f.get());
+ _Base::_M_init_functor(__functor, std::__addressof(__f.get()));
}
};