2000-10-11 01:43:26 +02:00
|
|
|
// The -*- C++ -*- dynamic memory management header.
|
2001-02-07 21:26:24 +01:00
|
|
|
|
2020-01-01 12:51:42 +01:00
|
|
|
// Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
2000-10-11 01:43:26 +02:00
|
|
|
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// This file is part of GCC.
|
2000-10-11 01:43:26 +02:00
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is free software; you can redistribute it and/or modify
|
2000-10-11 01:43:26 +02:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
2009-04-09 17:00:19 +02:00
|
|
|
// the Free Software Foundation; either version 3, or (at your option)
|
2000-10-11 01:43:26 +02:00
|
|
|
// any later version.
|
|
|
|
//
|
Makefile.am, [...]: Replace "GNU CC" with "GCC".
2003-05-24 Nathanael Nerode <neroden@gcc.gnu.org>
* libsupc++/Makefile.am, libsupc++/cxxabi.h, libsupc++/del_op.cc,
libsupc++/del_opnt.cc, libsupc++/del_opv.cc, libsupc++/del_opvnt.cc,
libsupc++/eh_alloc.cc, libsupc++/eh_aux_runtime.cc,
libsupc++/eh_catch.cc, libsupc++/eh_exception.cc,
libsupc++/eh_globals.cc, libsupc++/eh_personality.cc,
libsupc++/eh_term_handler.cc, libsupc++/eh_terminate.cc,
libsupc++/eh_throw.cc, libsupc++/eh_type.cc,
libsupc++/eh_unex_handler.cc, libsupc++/exception,
libsupc++/new, libsupc++/new_handler.cc, libsupc++/new_op.cc,
libsupc++/new_opnt.cc, libsupc++/new_opv.cc, libsupc++/new_opvnt.cc,
libsupc++/pure.cc, libsupc++/tinfo.cc, libsupc++/tinfo2.cc,
libsupc++/typeinfo, libsupc++/unwind-cxx.h, libsupc++/vec.cc:
Replace "GNU CC" with "GCC".
From-SVN: r67155
2003-05-24 18:22:03 +02:00
|
|
|
// GCC is distributed in the hope that it will be useful,
|
2000-10-11 01:43:26 +02:00
|
|
|
// 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.
|
|
|
|
//
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2000-10-11 01:43:26 +02:00
|
|
|
|
2001-07-11 21:35:49 +02:00
|
|
|
/** @file new
|
2006-11-29 21:59:22 +01:00
|
|
|
* This is a Standard C++ Library header.
|
|
|
|
*
|
Makefile.am (doxygen, [...]): Tweak targets.
2002-01-28 Phil Edwards <pme@gcc.gnu.org>
* Makefile.am (doxygen, doxygen-maint, doxygen-man): Tweak targets.
* Makefile.in: Regenerate.
* docs/doxygen/run_doxygen: Update, mostly for man pages.
* docs/doxygen/Intro.3: Update.
* docs/doxygen/TODO: Update.
* docs/doxygen/doxygroups.cc: Add namespace hook for __gnu_cxx.
* docs/doxygen/mainpage.doxy: Update.
* docs/doxygen/user.cfg.in: Update for header rename. Also
regenerate comments and variables with 1.2.12.
* docs/doxygen/maint.cfg.in: Remove file.
* include/bits/stl_relops.h: Doxygenate.
* include/bits/stl_tempbuf.h (std::_Temporary_buffer): Likewise.
* include/c_std/std_cassert.h, include/c_std/std_cctype.h,
include/c_std/std_cerrno.h, include/c_std/std_cfloat.h,
include/c_std/std_ciso646.h, include/c_std/std_climits.h,
include/c_std/std_clocale.h, include/c_std/std_cmath.h,
include/c_std/std_csetjmp.h, include/c_std/std_csignal.h,
include/c_std/std_cstdarg.h, include/c_std/std_cstddef.h,
include/c_std/std_cstdio.h, include/c_std/std_cstdlib.h,
include/c_std/std_cstring.h, include/c_std/std_ctime.h,
include/c_std/std_cwchar.h, include/c_std/std_cwctype.h,
include/ext/algorithm, include/ext/functional, include/ext/hash_map,
include/ext/hash_set, include/ext/iterator, include/ext/memory,
include/ext/numeric, include/ext/rb_tree, include/ext/rope,
include/ext/ropeimpl.h, include/ext/slist, include/ext/stl_hash_fun.h,
include/ext/stl_hashtable.h, include/ext/stl_rope.h,
include/std/std_algorithm.h, include/std/std_bitset.h,
include/std/std_complex.h, include/std/std_deque.h,
include/std/std_fstream.h, include/std/std_functional.h,
include/std/std_iomanip.h, include/std/std_ios.h,
include/std/std_iosfwd.h, include/std/std_iostream.h,
include/std/std_istream.h, include/std/std_iterator.h,
include/std/std_limits.h, include/std/std_list.h,
include/std/std_locale.h, include/std/std_map.h,
include/std/std_memory.h, include/std/std_numeric.h,
include/std/std_ostream.h, include/std/std_queue.h,
include/std/std_set.h, include/std/std_sstream.h,
include/std/std_stack.h, include/std/std_stdexcept.h,
include/std/std_streambuf.h, include/std/std_string.h,
include/std/std_utility.h, include/std/std_valarray.h,
include/std/std_vector.h: Add/correct @file doxygen hook.
* include/ext/memory: Doxygenate most of rest of file.
* libsupc++/exception: Doxygen output formatting.
* libsupc++/new: Say which header it is.
* testsuite/lib/libstdc++-v3-dg.exp: Fix spacing.
* docs/html/19_diagnostics/howto.html: Describe concept-checks switch.
* docs/html/23_containers/howto.html: Describe O(n) list::size().
* docs/html/27_io/howto.html: Also link to Langer and Kreft text.
From-SVN: r49300
2002-01-28 23:13:12 +01:00
|
|
|
* The header @c new defines several functions to manage dynamic memory and
|
2001-07-11 21:35:49 +02:00
|
|
|
* handling memory allocation errors; see
|
2019-05-10 23:41:11 +02:00
|
|
|
* https://gcc.gnu.org/onlinedocs/libstdc++/manual/dynamic_memory.html
|
|
|
|
* for more.
|
2001-07-11 21:35:49 +02:00
|
|
|
*/
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _NEW
|
|
|
|
#define _NEW
|
2000-10-11 01:43:26 +02:00
|
|
|
|
2010-02-18 18:58:53 +01:00
|
|
|
#pragma GCC system_header
|
|
|
|
|
2010-06-03 21:15:56 +02:00
|
|
|
#include <bits/c++config.h>
|
2000-10-11 01:43:26 +02:00
|
|
|
#include <exception>
|
|
|
|
|
2004-08-03 08:45:54 +02:00
|
|
|
#pragma GCC visibility push(default)
|
|
|
|
|
2000-10-11 01:43:26 +02:00
|
|
|
extern "C++" {
|
|
|
|
|
2001-02-07 21:26:24 +01:00
|
|
|
namespace std
|
|
|
|
{
|
abi.txt: New file.
2002-07-20 Phil Edwards <pme@gcc.gnu.org>
* docs/html/abi.txt: New file.
* docs/html/23_containers/howto.html: Tweak vector-overhead text.
* docs/html/ext/lwg-active.html, docs/html/ext/lwg-defects.html:
Import from upstream, R22.
* include/bits/char_traits.h, include/bits/stl_iterator.h,
include/bits/stl_iterator_base_types.h, libsupc++/exception,
libsupc++/new, libsupc++/typeinfo: Use @brief markup.
* include/bits/deque.tcc, include/bits/stl_alloc.h,
include/bits/stl_deque.h, include/bits/stl_list.h: Postpone removal
of deprecated functions until 3.4. (Same timeframe, different text.)
* include/bits/stl_vector.h: Ditto. Also do the same cleanups that
the other sequence classes received.
From-SVN: r55602
2002-07-20 08:26:27 +02:00
|
|
|
/**
|
|
|
|
* @brief Exception possibly thrown by @c new.
|
2009-02-21 01:45:21 +01:00
|
|
|
* @ingroup exceptions
|
abi.txt: New file.
2002-07-20 Phil Edwards <pme@gcc.gnu.org>
* docs/html/abi.txt: New file.
* docs/html/23_containers/howto.html: Tweak vector-overhead text.
* docs/html/ext/lwg-active.html, docs/html/ext/lwg-defects.html:
Import from upstream, R22.
* include/bits/char_traits.h, include/bits/stl_iterator.h,
include/bits/stl_iterator_base_types.h, libsupc++/exception,
libsupc++/new, libsupc++/typeinfo: Use @brief markup.
* include/bits/deque.tcc, include/bits/stl_alloc.h,
include/bits/stl_deque.h, include/bits/stl_list.h: Postpone removal
of deprecated functions until 3.4. (Same timeframe, different text.)
* include/bits/stl_vector.h: Ditto. Also do the same cleanups that
the other sequence classes received.
From-SVN: r55602
2002-07-20 08:26:27 +02:00
|
|
|
*
|
|
|
|
* @c bad_alloc (or classes derived from it) is used to report allocation
|
2001-07-11 21:35:49 +02:00
|
|
|
* errors from the throwing forms of @c new. */
|
2001-02-07 21:26:24 +01:00
|
|
|
class bad_alloc : public exception
|
|
|
|
{
|
2000-10-11 01:43:26 +02:00
|
|
|
public:
|
2001-03-13 20:32:00 +01:00
|
|
|
bad_alloc() throw() { }
|
2007-06-26 13:01:15 +02:00
|
|
|
|
2018-05-18 22:02:14 +02:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
bad_alloc(const bad_alloc&) = default;
|
|
|
|
bad_alloc& operator=(const bad_alloc&) = default;
|
|
|
|
#endif
|
|
|
|
|
2002-01-10 00:31:57 +01:00
|
|
|
// This declaration is not useless:
|
|
|
|
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
|
2002-01-09 21:39:27 +01:00
|
|
|
virtual ~bad_alloc() throw();
|
2007-06-26 13:01:15 +02:00
|
|
|
|
2007-02-01 14:36:51 +01:00
|
|
|
// See comment in eh_exception.cc.
|
|
|
|
virtual const char* what() const throw();
|
2000-10-11 01:43:26 +02:00
|
|
|
};
|
|
|
|
|
2013-05-09 05:58:00 +02:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
class bad_array_new_length : public bad_alloc
|
|
|
|
{
|
|
|
|
public:
|
2017-07-19 18:59:00 +02:00
|
|
|
bad_array_new_length() throw() { }
|
2013-05-09 05:58:00 +02:00
|
|
|
|
|
|
|
// This declaration is not useless:
|
|
|
|
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
|
|
|
|
virtual ~bad_array_new_length() throw();
|
|
|
|
|
|
|
|
// See comment in eh_exception.cc.
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2016-09-09 23:22:15 +02:00
|
|
|
#if __cpp_aligned_new
|
|
|
|
enum class align_val_t: size_t {};
|
|
|
|
#endif
|
|
|
|
|
2015-11-11 15:47:19 +01:00
|
|
|
struct nothrow_t
|
|
|
|
{
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
explicit nothrow_t() = default;
|
|
|
|
#endif
|
|
|
|
};
|
2007-06-26 13:01:15 +02:00
|
|
|
|
2000-10-11 01:43:26 +02:00
|
|
|
extern const nothrow_t nothrow;
|
2007-06-26 13:01:15 +02:00
|
|
|
|
2001-07-11 21:35:49 +02:00
|
|
|
/** If you write your own error handler to be called by @c new, it must
|
|
|
|
* be of this type. */
|
2000-10-11 01:43:26 +02:00
|
|
|
typedef void (*new_handler)();
|
2007-06-26 13:01:15 +02:00
|
|
|
|
|
|
|
/// Takes a replacement handler as the argument, returns the
|
|
|
|
/// previous handler.
|
2002-07-16 10:28:40 +02:00
|
|
|
new_handler set_new_handler(new_handler) throw();
|
2013-04-03 02:08:54 +02:00
|
|
|
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
/// Return the current new handler.
|
|
|
|
new_handler get_new_handler() noexcept;
|
|
|
|
#endif
|
2000-10-11 01:43:26 +02:00
|
|
|
} // namespace std
|
|
|
|
|
2001-07-11 21:35:49 +02:00
|
|
|
//@{
|
|
|
|
/** These are replaceable signatures:
|
|
|
|
* - normal single new and delete (no arguments, throw @c bad_alloc on error)
|
|
|
|
* - normal array new and delete (same)
|
|
|
|
* - @c nothrow single new and delete (take a @c nothrow argument, return
|
|
|
|
* @c NULL on error)
|
|
|
|
* - @c nothrow array new and delete (same)
|
|
|
|
*
|
|
|
|
* Placement new and delete signatures (take a memory address argument,
|
|
|
|
* does nothing) may not be replaced by a user's program.
|
|
|
|
*/
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
|
2011-10-12 20:40:58 +02:00
|
|
|
__attribute__((__externally_visible__));
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
|
2011-10-12 20:40:58 +02:00
|
|
|
__attribute__((__externally_visible__));
|
|
|
|
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
|
|
|
|
__attribute__((__externally_visible__));
|
|
|
|
void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
|
|
|
|
__attribute__((__externally_visible__));
|
2015-11-03 17:43:54 +01:00
|
|
|
#if __cpp_sized_deallocation
|
|
|
|
void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
|
|
|
|
__attribute__((__externally_visible__));
|
|
|
|
void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
|
|
|
|
__attribute__((__externally_visible__));
|
|
|
|
#endif
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
|
2018-08-24 20:24:42 +02:00
|
|
|
__attribute__((__externally_visible__, __malloc__));
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
|
2018-08-24 20:24:42 +02:00
|
|
|
__attribute__((__externally_visible__, __malloc__));
|
2011-10-12 20:40:58 +02:00
|
|
|
void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
|
|
|
|
__attribute__((__externally_visible__));
|
|
|
|
void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
|
|
|
|
__attribute__((__externally_visible__));
|
2016-09-09 23:22:15 +02:00
|
|
|
#if __cpp_aligned_new
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
|
2016-09-09 23:22:15 +02:00
|
|
|
__attribute__((__externally_visible__));
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
|
2018-08-24 20:24:42 +02:00
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__));
|
2016-09-09 23:22:15 +02:00
|
|
|
void operator delete(void*, std::align_val_t)
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
|
|
|
|
void operator delete(void*, std::align_val_t, const std::nothrow_t&)
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
|
2016-09-09 23:22:15 +02:00
|
|
|
__attribute__((__externally_visible__));
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
|
2018-08-24 20:24:42 +02:00
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__));
|
2016-09-09 23:22:15 +02:00
|
|
|
void operator delete[](void*, std::align_val_t)
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
|
|
|
|
void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
|
|
|
|
#if __cpp_sized_deallocation
|
|
|
|
void operator delete(void*, std::size_t, std::align_val_t)
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
|
|
|
|
void operator delete[](void*, std::size_t, std::align_val_t)
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
|
|
|
|
#endif // __cpp_sized_deallocation
|
|
|
|
#endif // __cpp_aligned_new
|
2000-10-11 01:43:26 +02:00
|
|
|
|
2001-02-07 21:26:24 +01:00
|
|
|
// Default placement versions of operator new.
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
|
2011-10-12 20:40:58 +02:00
|
|
|
{ return __p; }
|
2019-01-21 12:47:30 +01:00
|
|
|
_GLIBCXX_NODISCARD inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
|
2011-10-12 20:40:58 +02:00
|
|
|
{ return __p; }
|
2002-07-24 21:49:21 +02:00
|
|
|
|
|
|
|
// Default placement versions of operator delete.
|
2011-10-12 20:40:58 +02:00
|
|
|
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
|
|
|
|
inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
|
2001-07-11 21:35:49 +02:00
|
|
|
//@}
|
2000-10-11 01:43:26 +02:00
|
|
|
} // extern "C++"
|
|
|
|
|
2017-11-24 01:00:46 +01:00
|
|
|
#if __cplusplus >= 201703L
|
2017-04-19 12:49:12 +02:00
|
|
|
#ifdef _GLIBCXX_HAVE_BUILTIN_LAUNDER
|
2016-10-28 16:09:33 +02:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
#define __cpp_lib_launder 201606
|
|
|
|
/// Pointer optimization barrier [ptr.launder]
|
|
|
|
template<typename _Tp>
|
2017-11-24 01:00:46 +01:00
|
|
|
[[nodiscard]] constexpr _Tp*
|
2016-10-28 16:09:33 +02:00
|
|
|
launder(_Tp* __p) noexcept
|
|
|
|
{ return __builtin_launder(__p); }
|
|
|
|
|
|
|
|
// The program is ill-formed if T is a function type or
|
|
|
|
// (possibly cv-qualified) void.
|
|
|
|
|
Implement P0012R1, Make exception specifications part of the type system.
gcc/cp/
* cp-tree.h (enum tsubst_flags): Add tf_fndecl_type.
(flag_noexcept_type, ce_type): New.
* call.c (build_conv): Add ck_fnptr.
(enum conversion_kind): Change ck_tsafe to ck_fnptr.
(convert_like_real): Likewise.
(standard_conversion): Likewise. Allow function pointer
conversions for pointers to member functions.
(reference_compatible_p): Allow function pointer conversions.
(direct_reference_binding): Likewise.
(reference_binding): Reference-compatible is no longer a subset of
reference-related.
(is_subseq): Also strip ck_lvalue after next_conversion.
* class.c (instantiate_type): Check fnptr_conv_p.
(resolve_address_of_overloaded_function): Likewise.
* cvt.c (can_convert_tx_safety): Now static.
(noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New.
* decl.c (flag_noexcept_type): Define.
(cxx_init_decl_processing): Set it.
(bad_specifiers): Check it.
(grokdeclarator) [cdk_function]: Add exception-spec to type here.
* lambda.c (maybe_add_lambda_conv_op): Add exception-spec to
returned pointer.
* mangle.c (struct globals): Add need_cxx1z_warning.
(mangle_decl): Check it.
(write_exception_spec): New.
(write_function_type): Call it.
(canonicalize_for_substitution): Handle exception spec.
(write_type): Likewise.
(write_encoding): Set processing_template_decl across mangling of
partially-instantiated type.
* pt.c (determine_specialization): Pass tf_fndecl_type.
(tsubst_decl, fn_type_unification): Likewise.
(tsubst): Strip tf_fndecl_type, pass it to
tsubst_exception_specification.
(convert_nontype_argument_function): Handle function pointer
conversion.
(convert_nontype_argument): Likewise.
(unify, for_each_template_parm_r): Walk into noexcept-specifier.
* rtti.c (ptr_initializer): Encode noexcept.
* tree.c (canonical_eh_spec): New.
(build_exception_variant): Use it.
* typeck.c (composite_pointer_type): Handle fnptr conversion.
(comp_except_specs): Compare canonical EH specs.
(structural_comptypes): Call it.
gcc/c-family/
* c.opt (Wc++1z-compat): New.
* c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type.
libstdc++-v3/
* include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM)
(_GLIBCXX_NOEXCEPT_QUAL): New.
* include/std/type_traits (is_function): Use them.
* libsubc++/new (launder): Likewise.
* libsupc++/cxxabi.h (__pbase_type_info::__masks): Add
__noexcept_mask.
* libsupc++/pbase_type_info.cc (__do_catch): Handle function
pointer conversion.
libiberty/
* cp-demangle.c (is_fnqual_component_type): New.
(d_encoding, d_print_comp_inner, d_print_mod_list): Use it.
(FNQUAL_COMPONENT_CASE): New.
(d_make_comp, has_return_type, d_print_comp_inner)
(d_print_function_type): Use it.
(next_is_type_qual): New.
(d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec.
include/
* demangle.h (enum demangle_component_type): Add
DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC.
From-SVN: r241944
2016-11-08 00:09:29 +01:00
|
|
|
template<typename _Ret, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
|
|
|
|
void launder(_Ret (*)(_Args...) _GLIBCXX_NOEXCEPT_QUAL) = delete;
|
|
|
|
template<typename _Ret, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
|
|
|
|
void launder(_Ret (*)(_Args......) _GLIBCXX_NOEXCEPT_QUAL) = delete;
|
2016-10-28 16:09:33 +02:00
|
|
|
|
|
|
|
void launder(void*) = delete;
|
|
|
|
void launder(const void*) = delete;
|
|
|
|
void launder(volatile void*) = delete;
|
|
|
|
void launder(const volatile void*) = delete;
|
|
|
|
}
|
2017-04-19 17:18:24 +02:00
|
|
|
#endif // _GLIBCXX_HAVE_BUILTIN_LAUNDER
|
2016-10-28 16:09:33 +02:00
|
|
|
#endif // C++17
|
|
|
|
|
2019-02-13 23:13:45 +01:00
|
|
|
#if __cplusplus > 201703L
|
2018-11-13 05:40:01 +01:00
|
|
|
namespace std
|
|
|
|
{
|
2019-05-10 23:41:11 +02:00
|
|
|
/// Tag type used to declare a class-specific operator delete that can
|
|
|
|
/// invoke the destructor before deallocating the memory.
|
2018-11-13 05:40:01 +01:00
|
|
|
struct destroying_delete_t
|
|
|
|
{
|
|
|
|
explicit destroying_delete_t() = default;
|
|
|
|
};
|
2019-05-10 23:41:11 +02:00
|
|
|
/// Tag variable of type destroying_delete_t.
|
2018-11-13 05:40:01 +01:00
|
|
|
inline constexpr destroying_delete_t destroying_delete{};
|
|
|
|
}
|
2019-02-13 23:13:45 +01:00
|
|
|
// Only define the feature test macro if the compiler supports the feature:
|
|
|
|
#if __cpp_impl_destroying_delete
|
|
|
|
# define __cpp_lib_destroying_delete 201806L
|
|
|
|
#endif
|
|
|
|
#endif // C++20
|
2018-11-13 05:40:01 +01:00
|
|
|
|
2004-08-03 08:45:54 +02:00
|
|
|
#pragma GCC visibility pop
|
|
|
|
|
2000-10-11 01:43:26 +02:00
|
|
|
#endif
|