From 7b55fa54d4f8040c8f01acd3c725670000640538 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 1 Dec 2014 13:49:20 +0000 Subject: re PR libstdc++/63840 (std::function copy constructor deletes an uninitialized pointer if new fails) PR libstdc++/63840 * include/std/functional (function::function(const function&)): Set _M_manager after operations that might throw. * include/tr1/functional (function::function(const function&), function::function(_Functor, _Useless)): Likewise. * testsuite/20_util/function/63840.cc: New. * testsuite/tr1/3_function_objects/function/63840.cc: New. From-SVN: r218215 --- libstdc++-v3/include/tr1/functional | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libstdc++-v3/include/tr1/functional') diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional index 20785ff..58af9102 100644 --- a/libstdc++-v3/include/tr1/functional +++ b/libstdc++-v3/include/tr1/functional @@ -2112,9 +2112,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { if (static_cast(__x)) { + __x._M_manager(_M_functor, __x._M_functor, __clone_functor); _M_invoker = __x._M_invoker; _M_manager = __x._M_manager; - __x._M_manager(_M_functor, __x._M_functor, __clone_functor); } } @@ -2130,9 +2130,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (_My_handler::_M_not_empty_function(__f)) { + _My_handler::_M_init_functor(_M_functor, __f); _M_invoker = &_My_handler::_M_invoke; _M_manager = &_My_handler::_M_manager; - _My_handler::_M_init_functor(_M_functor, __f); } } -- cgit v1.1