+2018-06-18 Jonathan Wakely <jwakely@redhat.com>
+
+ LWG 3035. std::allocator's constructors should be constexpr
+ * include/bits/allocator.h (allocator): Add constexpr to constructors
+ for C++2a. Replace dynamic exception specifications with NOTHROW
+ macro.
+ (allocator, operator==, operator!=): Replace USE_NOEXCEPT macro with
+ NOTHROW.
+ * include/bits/c++config (_GLIBCXX20_CONSTEXPR): Define.
+ * include/ext/malloc_allocator.h (malloc_allocator): Add constexpr
+ to constructors for C++2a.
+ * include/ext/new_allocator.h (new_allocator): Likewise.
+
2018-06-16 Jonathan Wakely <jwakely@redhat.com>
LWG 3076 basic_string CTAD ambiguity
typedef true_type is_always_equal;
#endif
- allocator() throw() { }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3035. std::allocator's constructors should be constexpr
+ _GLIBCXX20_CONSTEXPR
+ allocator() _GLIBCXX_NOTHROW { }
- allocator(const allocator& __a) throw()
+ _GLIBCXX20_CONSTEXPR
+ allocator(const allocator& __a) _GLIBCXX_NOTHROW
: __allocator_base<_Tp>(__a) { }
+
#if __cplusplus >= 201103L
// Avoid implicit deprecation.
allocator& operator=(const allocator&) = default;
#endif
template<typename _Tp1>
- allocator(const allocator<_Tp1>&) throw() { }
+ _GLIBCXX20_CONSTEXPR
+ allocator(const allocator<_Tp1>&) _GLIBCXX_NOTHROW { }
- ~allocator() throw() { }
+ ~allocator() _GLIBCXX_NOTHROW { }
// Inherit everything else.
};
template<typename _T1, typename _T2>
inline bool
operator==(const allocator<_T1>&, const allocator<_T2>&)
- _GLIBCXX_USE_NOEXCEPT
+ _GLIBCXX_NOTHROW
{ return true; }
template<typename _Tp>
inline bool
operator==(const allocator<_Tp>&, const allocator<_Tp>&)
- _GLIBCXX_USE_NOEXCEPT
+ _GLIBCXX_NOTHROW
{ return true; }
template<typename _T1, typename _T2>
inline bool
operator!=(const allocator<_T1>&, const allocator<_T2>&)
- _GLIBCXX_USE_NOEXCEPT
+ _GLIBCXX_NOTHROW
{ return false; }
template<typename _Tp>
inline bool
operator!=(const allocator<_Tp>&, const allocator<_Tp>&)
- _GLIBCXX_USE_NOEXCEPT
+ _GLIBCXX_NOTHROW
{ return false; }
// Invalid allocator<cv T> partial specializations.
#endif
#ifndef _GLIBCXX17_CONSTEXPR
-# if __cplusplus > 201402L
+# if __cplusplus >= 201703L
# define _GLIBCXX17_CONSTEXPR constexpr
# else
# define _GLIBCXX17_CONSTEXPR
# endif
#endif
+#ifndef _GLIBCXX20_CONSTEXPR
+# if __cplusplus > 201703L
+# define _GLIBCXX20_CONSTEXPR constexpr
+# else
+# define _GLIBCXX20_CONSTEXPR
+# endif
+#endif
+
#ifndef _GLIBCXX17_INLINE
-# if __cplusplus > 201402L
+# if __cplusplus >= 201703L
# define _GLIBCXX17_INLINE inline
# else
# define _GLIBCXX17_INLINE
typedef std::true_type propagate_on_container_move_assignment;
#endif
+ _GLIBCXX20_CONSTEXPR
malloc_allocator() _GLIBCXX_USE_NOEXCEPT { }
+ _GLIBCXX20_CONSTEXPR
malloc_allocator(const malloc_allocator&) _GLIBCXX_USE_NOEXCEPT { }
template<typename _Tp1>
+ _GLIBCXX20_CONSTEXPR
malloc_allocator(const malloc_allocator<_Tp1>&)
_GLIBCXX_USE_NOEXCEPT { }
typedef std::true_type propagate_on_container_move_assignment;
#endif
+ _GLIBCXX20_CONSTEXPR
new_allocator() _GLIBCXX_USE_NOEXCEPT { }
+ _GLIBCXX20_CONSTEXPR
new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
template<typename _Tp1>
+ _GLIBCXX20_CONSTEXPR
new_allocator(const new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { }
~new_allocator() _GLIBCXX_USE_NOEXCEPT { }