+2019-01-20 Ulrich Drepper <drepper@redhat.com>
+
+ Fix after C++ P0600 implementation.
+ * g++.dg/init/new39.C: Don't just ignore result of new.
+
2019-01-20 Iain Buclaw <ibuclaw@gdcproject.org>
* gdc.dg/runnable.d: Add more tests for comparing complex types.
main ()
{
try {
- ::operator new(size_t(-1));
+ (void) ::operator new(size_t(-1));
abort ();
} catch (std::bad_alloc &) {
}
+2019-01-20 Ulrich Drepper <drepper@redhat.com>
+
+ Implement C++20 P0600r1.
+ * include/backward/hash_map: Add nodiscard attribute to empty.
+ * include/backward/hash_set: Likewise.
+ * backward/hashtable.h: Likewise.
+ * include/bits/basic_string.h: Likewise.
+ * include/bits/forward_list.h: Likewise.
+ * include/bits/hashtable.h: Likewise.
+ * include/bits/regex.h: Likewise.
+ * include/bits/stl_deque.h: Likewise.
+ * include/bits/stl_list.h: Likewise.
+ * include/bits/stl_map.h: Likewise.
+ * include/bits/stl_multimap.h: Likewise.
+ * include/bits/stl_multiset.h: Likewise.
+ * include/bits/stl_queue.h: Likewise.
+ * include/bits/stl_set.h: Likewise.
+ * include/bits/stl_stack.h: Likewise.
+ * include/bits/stl_tree.h: Likewise.
+ * include/bits/stl_vector.h: Likewise.
+ * include/bits/unordered_map.h: Likewise.
+ * include/bits/unordered_set.h: Likewise.
+ * include/debug/array: Likewise.
+ * include/experimental/any: Likewise.
+ * include/experimental/bits/fs_path.h: Likewise.
+ * include/experimental/internet: Likewise.
+ * include/experimental/string_view: Likewise.
+ * include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ info_fn_imps.hpp: Likewise.
+ * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+ left_child_next_sibling_heap_.hpp: Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hp:
+ Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp:
+ Likewise.
+ * include/ext/pb_ds/detail/tree_trace_base.hpp: Likewise.
+ * include/ext/pb_ds/trie_policy.hpp: Likewise.
+ * include/ext/rope: Likewise.
+ * include/ext/slist: Likewise.
+ * include/ext/vstring.h: Likewise.
+ * include/profile/array: Likewise.
+ * include/std/array: Likewise.
+ * include/tr1/array: Likewise.
+ * include/tr1/hashtable.h: Likewise.
+ * include/tr1/regex: Likewise.
+ * include/tr2/dynamic_bitset: Likewise.
+ * include/bits/alloc_traits.h: Add nodiscard attribute to
+ allocate.
+ * include/experimental/memory_resource: Likewise.
+ * include/ext/alloc_traits.h: Likewise.
+ * include/ext/array_allocator.h: Likewise.
+ * include/ext/bitmap_allocator.h: Likewise.
+ * include/ext/debug_allocator.h: Likewise.
+ * include/ext/extptr_allocator.h: Likewise.
+ * include/ext/mt_allocator.h: Likewise.
+ * include/ext/new_allocator.h: Likewise.
+ * include/ext/pool_allocator.h: Likewise.
+ * include/ext/throw_allocator.h: Likewise.
+ * include/std/scoped_allocator: Likewise.
+ * libsupc++/eh_alloc.cc: Likewise.
+ * include/std/future: Add nodiscard attribute to async.
+ * libsupc++/new: Add nodiscard attribute to new.
+
2019-01-18 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/87514
max_size() const
{ return _M_ht.max_size(); }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }
max_size() const
{ return _M_ht.max_size(); }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }
max_size() const
{ return _M_ht.max_size(); }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }
max_size() const
{ return _M_ht.max_size(); }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return _M_ht.empty(); }
max_size() const
{ return size_type(-1); }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return size() == 0; }
*
* Calls @c a.allocate(n)
*/
- static pointer
+ _GLIBCXX_NODISCARD static pointer
allocate(_Alloc& __a, size_type __n)
{ return __a.allocate(__n); }
* Returns <tt> a.allocate(n, hint) </tt> if that expression is
* well-formed, otherwise returns @c a.allocate(n)
*/
- static pointer
+ _GLIBCXX_NODISCARD static pointer
allocate(_Alloc& __a, size_type __n, const_void_pointer __hint)
{ return _S_allocate(__a, __n, __hint, 0); }
*
* Calls @c a.allocate(n)
*/
- static pointer
+ _GLIBCXX_NODISCARD static pointer
allocate(allocator_type& __a, size_type __n)
{ return __a.allocate(__n); }
*
* Returns <tt> a.allocate(n, hint) </tt>
*/
- static pointer
+ _GLIBCXX_NODISCARD static pointer
allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
{ return __a.allocate(__n, __hint); }
* Returns true if the %string is empty. Equivalent to
* <code>*this == ""</code>.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }
* Returns true if the %string is empty. Equivalent to
* <code>*this == ""</code>.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }
* Returns true if the %forward_list is empty. (Thus begin() would
* equal end().)
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return this->_M_impl._M_head._M_next == nullptr; }
size() const noexcept
{ return _M_element_count; }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return size() == 0; }
* @retval true The %match_results object is empty.
* @retval false The %match_results object is not empty.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return size() == 0; }
* Returns true if the %deque is empty. (Thus begin() would
* equal end().)
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_finish == this->_M_impl._M_start; }
* Returns true if the %list is empty. (Thus begin() would equal
* end().)
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
/** Returns true if the %map is empty. (Thus begin() would equal
* end().)
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }
// capacity
/** Returns true if the %multimap is empty. */
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }
#endif
/// Returns true if the %set is empty.
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }
/**
* Returns true if the %queue is empty.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return c.empty(); }
/**
* Returns true if the %queue is empty.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return c.empty(); }
#endif
/// Returns true if the %set is empty.
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_t.empty(); }
/**
* Returns true if the %stack is empty.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return c.empty(); }
rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(begin()); }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return _M_impl._M_node_count == 0; }
* Returns true if the %vector is empty. (Thus begin() would
* equal end().)
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return begin() == end(); }
// size and capacity:
/// Returns true if the %unordered_map is empty.
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }
// size and capacity:
/// Returns true if the %unordered_multimap is empty.
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }
// size and capacity:
/// Returns true if the %unordered_set is empty.
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }
// size and capacity:
/// Returns true if the %unordered_multiset is empty.
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return _M_h.empty(); }
template<std::size_t _Size>
struct _Array_check_nonempty
{
- bool empty() { return _Size == 0; }
+ _GLIBCXX_NODISCARD bool empty() { return _Size == 0; }
_Array_check_nonempty()
{ __glibcxx_check_nonempty(); }
constexpr size_type
max_size() const noexcept { return _Nm; }
- constexpr bool
+ _GLIBCXX_NODISCARD constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.
// observers
/// Reports whether there is a contained object or not.
- bool empty() const noexcept { return _M_manager == nullptr; }
+ _GLIBCXX_NODISCARD bool empty() const noexcept { return _M_manager == nullptr; }
#if __cpp_rtti
/// The @c typeid of the contained object, or @c typeid(void) if empty.
// query
- bool empty() const noexcept { return _M_pathname.empty(); }
+ _GLIBCXX_NODISCARD bool empty() const noexcept { return _M_pathname.empty(); }
bool has_root_name() const;
bool has_root_directory() const;
bool has_root_path() const;
iterator begin() const noexcept { return _M_begin; }
iterator end() const noexcept { return _M_end; }
- bool empty() const noexcept { return _M_begin == _M_end; }
+ _GLIBCXX_NODISCARD bool empty() const noexcept { return _M_begin == _M_end; }
size_t
size() const noexcept { return _M_end->to_uint() - _M_begin->to_uint(); }
iterator begin() const noexcept { return _M_begin; }
iterator end() const noexcept { return _M_end; }
- bool empty() const noexcept { return _M_begin == _M_end; }
+ _GLIBCXX_NODISCARD bool empty() const noexcept { return _M_begin == _M_end; }
iterator
find(const address_v6& __addr) const noexcept
// size:
size_type size() const noexcept { return _M_size; }
size_type max_size() const noexcept { return _M_results.max_size(); }
- bool empty() const noexcept { return _M_results.empty(); }
+ _GLIBCXX_NODISCARD bool empty() const noexcept { return _M_results.empty(); }
// element access:
const_iterator begin() const { return _M_results.begin(); }
memory_resource& operator=(const memory_resource&) = default;
- void*
+ _GLIBCXX_NODISCARD void*
allocate(size_t __bytes, size_t __alignment = _S_max_align)
{ return do_allocate(__bytes, __alignment); }
polymorphic_allocator&
operator=(const polymorphic_allocator& __rhs) = default;
- _Tp* allocate(size_t __n)
+ _GLIBCXX_NODISCARD _Tp* allocate(size_t __n)
{ return static_cast<_Tp*>(_M_resource->allocate(__n * sizeof(_Tp),
alignof(_Tp))); }
/ sizeof(value_type) / 4;
}
- constexpr bool
+ _GLIBCXX_NODISCARD constexpr bool
empty() const noexcept
{ return this->_M_len == 0; }
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type difference_type;
- static pointer
+ _GLIBCXX_NODISCARD static pointer
allocate(_Alloc& __a, size_type __n)
{ return __a.allocate(__n); }
~array_allocator() _GLIBCXX_USE_NOEXCEPT { }
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n, const void* = 0)
{
if (_M_array == 0 || _M_used + __n > _M_array->size())
_M_space_left() const throw()
{ return _M_end_of_storage - _M_finish; }
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n)
{ return static_cast<pointer>(::operator new(__n * sizeof(_Tp))); }
~bitmap_allocator() _GLIBCXX_USE_NOEXCEPT
{ }
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n)
{
if (__n > this->max_size())
}
}
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n, typename bitmap_allocator<void>::const_pointer)
{ return allocate(__n); }
debug_allocator(const _Alloc& __a)
: _M_allocator(__a), _M_extra(_S_extra()) { }
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n)
{
pointer __res = _M_allocator.allocate(__n + _M_extra);
return __res + _M_extra;
}
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n, const void* __hint)
{
pointer __res = _M_allocator.allocate(__n + _M_extra, __hint);
const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
- pointer allocate(size_type __n, void* __hint = 0)
+ _GLIBCXX_NODISCARD pointer allocate(size_type __n, void* __hint = 0)
{ return _M_real_alloc.allocate(__n,__hint); }
void deallocate(pointer __p, size_type __n)
~__mt_alloc() _GLIBCXX_USE_NOEXCEPT { }
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n, const void* = 0);
void
};
template<typename _Tp, typename _Poolp>
- typename __mt_alloc<_Tp, _Poolp>::pointer
+ _GLIBCXX_NODISCARD typename __mt_alloc<_Tp, _Poolp>::pointer
__mt_alloc<_Tp, _Poolp>::
allocate(size_type __n, const void*)
{
// NB: __n is permitted to be 0. The C++ standard says nothing
// about what the return value is when __n == 0.
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n, const void* = static_cast<const void*>(0))
{
if (__n > this->max_size())
*/
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
~binary_heap();
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type
*/
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
max_size() const;
/// True if size() == 0.
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
/// Return current hash_fn.
{ return m_entry_allocator.max_size(); }
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{ return m_num_used_e; }
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
max_size() const;
/// True if size() == 0.
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
/// Return current hash_fn.
{ return s_entry_allocator.max_size(); }
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
*/
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
~left_child_next_sibling_heap();
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type
{ return s_entry_allocator.max_size(); }
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
inline size_type
max_size() const;
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
inline mapped_reference
{ return s_value_alloc.max_size(); }
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
inline size_type
max_size() const;
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type
*/
PB_DS_CLASS_T_DEC
+_GLIBCXX_NODISCARD
inline bool
PB_DS_CLASS_C_DEC::
empty() const
}
}
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const
{ return m_bag.empty(); }
};
~PB_DS_PAT_TRIE_NAME();
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type
inline void
pop();
- inline bool
+ _GLIBCXX_NODISCARD inline bool
empty() const;
inline size_type
}
template<typename _Node, typename _Alloc>
- inline bool
+ _GLIBCXX_NODISCARD inline bool
rc<_Node, _Alloc>::
empty() const
{
void
trace_node(node_const_iterator, size_type) const;
- virtual bool
+ _GLIBCXX_NODISCARD virtual bool
empty() const = 0;
virtual node_const_iterator
typedef typename __rebind_ma::reference metadata_reference;
/// Returns true if the container is empty.
- virtual bool
+ _GLIBCXX_NODISCARD virtual bool
empty() const = 0;
/// Returns the iterator associated with the trie's first element.
destroy(pointer __p) { __p->~_Tp(); }
#endif
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n, const void* = 0);
void
__pool_alloc<_Tp>::_S_force_new;
template<typename _Tp>
- _Tp*
+ _GLIBCXX_NODISCARD _Tp*
__pool_alloc<_Tp>::allocate(size_type __n, const void*)
{
pointer __ret = 0;
static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
public:
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return 0 == this->_M_tree_ptr; }
max_size() const
{ return size_type(-1); }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return this->_M_head._M_next == 0; }
address(const_reference __x) const _GLIBCXX_NOEXCEPT
{ return std::__addressof(__x); }
- pointer
+ _GLIBCXX_NODISCARD pointer
allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
{
if (__n > this->max_size())
* Returns true if the %string is empty. Equivalent to
* <code>*this == ""</code>.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }
constexpr size_type
max_size() const noexcept { return _Nm; }
- constexpr bool
+ _GLIBCXX_NODISCARD constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.
constexpr size_type
max_size() const noexcept { return _Nm; }
- constexpr bool
+ _GLIBCXX_NODISCARD constexpr bool
empty() const noexcept { return size() == 0; }
// Element access.
/// async
template<typename _Fn, typename... _Args>
- future<__async_result_of<_Fn, _Args...>>
+ _GLIBCXX_NODISCARD future<__async_result_of<_Fn, _Args...>>
async(launch __policy, _Fn&& __fn, _Args&&... __args)
{
std::shared_ptr<__future_base::_State_base> __state;
/// async, potential overload
template<typename _Fn, typename... _Args>
- inline future<__async_result_of<_Fn, _Args...>>
+ _GLIBCXX_NODISCARD inline future<__async_result_of<_Fn, _Args...>>
async(_Fn&& __fn, _Args&&... __args)
{
return std::async(launch::async|launch::deferred,
const outer_allocator_type& outer_allocator() const noexcept
{ return static_cast<const _OuterAlloc&>(*this); }
- pointer allocate(size_type __n)
+ _GLIBCXX_NODISCARD pointer allocate(size_type __n)
{ return __traits::allocate(outer_allocator(), __n); }
- pointer allocate(size_type __n, const_void_pointer __hint)
+ _GLIBCXX_NODISCARD pointer allocate(size_type __n, const_void_pointer __hint)
{ return __traits::allocate(outer_allocator(), __n, __hint); }
void deallocate(pointer __p, size_type __n)
size_type
max_size() const { return _Nm; }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const { return size() == 0; }
// Element access.
size() const
{ return _M_element_count; }
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return size() == 0; }
* @retval true The %match_results object is empty.
* @retval false The %match_results object is not empty.
*/
- bool
+ _GLIBCXX_NODISCARD bool
empty() const
{ return size() == 0; }
{ return this->_M_size(); }
/// Returns true if the dynamic_bitset is empty.
- bool
+ _GLIBCXX_NODISCARD bool
empty() const noexcept
{ return (this->_M_Nb == 0); }
public:
pool();
- void *allocate (std::size_t);
+ _GLIBCXX_NODISCARD void *allocate (std::size_t);
void free (void *);
bool in_pool (void *);
* Placement new and delete signatures (take a memory address argument,
* does nothing) may not be replaced by a user's program.
*/
-void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
+_GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
__attribute__((__externally_visible__));
-void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
+_GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
__attribute__((__externally_visible__));
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__));
#endif
-void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
+_GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__, __malloc__));
-void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
+_GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
__attribute__((__externally_visible__, __malloc__));
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__));
#if __cpp_aligned_new
-void* operator new(std::size_t, std::align_val_t)
+_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
__attribute__((__externally_visible__));
-void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
+_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__));
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__));
-void* operator new[](std::size_t, std::align_val_t)
+_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
__attribute__((__externally_visible__));
-void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
+_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__));
void operator delete[](void*, std::align_val_t)
_GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__));
#endif // __cpp_aligned_new
// Default placement versions of operator new.
-inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
+_GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
{ return __p; }
-inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
+_GLIBCXX_NODISCARD inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
{ return __p; }
// Default placement versions of operator delete.