mirror of git://gcc.gnu.org/git/gcc.git
Use ::new to avoid finding overloaded operator new
PR libstdc++/72820 * include/std/functional (_Function_base::_Base_manager::_M_clone): Qualify new operator. * testsuite/20_util/function/cons/72820.cc: New test. From-SVN: r239191
This commit is contained in:
parent
467719fbf2
commit
6ef835c6c0
|
|
@ -1,5 +1,10 @@
|
||||||
2016-08-06 Jonathan Wakely <jwakely@redhat.com>
|
2016-08-06 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/72820
|
||||||
|
* include/std/functional (_Function_base::_Base_manager::_M_clone):
|
||||||
|
Qualify new operator.
|
||||||
|
* testsuite/20_util/function/cons/72820.cc: New test.
|
||||||
|
|
||||||
* doc/xml/manual/status_cxx2017.xml: Add missing LFTSv2 features.
|
* doc/xml/manual/status_cxx2017.xml: Add missing LFTSv2 features.
|
||||||
* doc/html/manual/status.html: Regenerate.
|
* doc/html/manual/status.html: Regenerate.
|
||||||
* include/Makefile.am: Add new header.
|
* include/Makefile.am: Add new header.
|
||||||
|
|
|
||||||
|
|
@ -1472,7 +1472,7 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type)
|
||||||
static void
|
static void
|
||||||
_M_clone(_Any_data& __dest, const _Any_data& __source, true_type)
|
_M_clone(_Any_data& __dest, const _Any_data& __source, true_type)
|
||||||
{
|
{
|
||||||
new (__dest._M_access()) _Functor(__source._M_access<_Functor>());
|
::new (__dest._M_access()) _Functor(__source._M_access<_Functor>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone a function object that is not location-invariant or
|
// Clone a function object that is not location-invariant or
|
||||||
|
|
@ -1553,7 +1553,7 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type)
|
||||||
private:
|
private:
|
||||||
static void
|
static void
|
||||||
_M_init_functor(_Any_data& __functor, _Functor&& __f, true_type)
|
_M_init_functor(_Any_data& __functor, _Functor&& __f, true_type)
|
||||||
{ new (__functor._M_access()) _Functor(std::move(__f)); }
|
{ ::new (__functor._M_access()) _Functor(std::move(__f)); }
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_M_init_functor(_Any_data& __functor, _Functor&& __f, false_type)
|
_M_init_functor(_Any_data& __functor, _Functor&& __f, false_type)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2016 Free Software Foundation, Inc.
|
||||||
|
//
|
||||||
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 3, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING3. If not see
|
||||||
|
// <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// { dg-do compile { target c++11 } }
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
struct foo {
|
||||||
|
void operator()() { }
|
||||||
|
static void* operator new(std::size_t, void* p);
|
||||||
|
};
|
||||||
|
|
||||||
|
std::function<void()> f = foo{};
|
||||||
Loading…
Reference in New Issue