[PATCH] PR c++/91369 Implement P0784R7 changes to allocation and construction

Jonathan Wakely jwakely@redhat.com
Thu Oct 24 14:52:00 GMT 2019


On 23/10/19 20:27 +0100, Jonathan Wakely wrote:
>--- a/libstdc++-v3/include/bits/allocator.h
>+++ b/libstdc++-v3/include/bits/allocator.h
>@@ -154,13 +154,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> 	_GLIBCXX20_CONSTEXPR
> 	allocator(const allocator<_Tp1>&) _GLIBCXX_NOTHROW { }
>
>+#if __cplusplus <= 201703L
>       ~allocator() _GLIBCXX_NOTHROW { }
>+#endif

This changes the value of is_trivially_destructible_v<allocator<T>> so
maybe it would be better to keep the user-provided destructor but make
it constexpr:

--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -154,9 +154,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        _GLIBCXX20_CONSTEXPR
        allocator(const allocator<_Tp1>&) _GLIBCXX_NOTHROW { }

-#if __cplusplus <= 201703L
+      _GLIBCXX20_CONSTEXPR
       ~allocator() _GLIBCXX_NOTHROW { }
-#endif

 #if __cplusplus > 201703L
       [[nodiscard,__gnu__::__always_inline__]]

With the earlier commit r277300 I've still changed the result of
is_trivially_destructible_v<allocator<void>> and
is_trivially_*_constructible_v<allocator<void>> because the
allocator<void> explicit specialization no longer exists for C++20.
That might be a bigger problem.



More information about the Gcc-patches mailing list