diff options
-rw-r--r-- | libstdc++-v3/ChangeLog | 13 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/allocator.h | 22 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 12 | ||||
-rw-r--r-- | libstdc++-v3/include/ext/malloc_allocator.h | 3 | ||||
-rw-r--r-- | libstdc++-v3/include/ext/new_allocator.h | 3 |
5 files changed, 43 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2c3237a..166522c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +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 diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 2da499f..c4e3a4b 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -128,19 +128,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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. }; @@ -148,25 +154,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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. diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 838afc5..4a096a1 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -122,15 +122,23 @@ #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 diff --git a/libstdc++-v3/include/ext/malloc_allocator.h b/libstdc++-v3/include/ext/malloc_allocator.h index 75a74a3..8739c1f 100644 --- a/libstdc++-v3/include/ext/malloc_allocator.h +++ b/libstdc++-v3/include/ext/malloc_allocator.h @@ -75,11 +75,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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 { } diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h index 78e2019..19e7ad0 100644 --- a/libstdc++-v3/include/ext/new_allocator.h +++ b/libstdc++-v3/include/ext/new_allocator.h @@ -76,11 +76,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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 { } |