2019-10-25 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/allocator.h: Check __cpp_constexpr_dynamic_alloc
+ before making the std::allocator destructor constexpr.
+ * testsuite/20_util/allocator/requirements/constexpr.cc: New test.
+
* include/bits/range_cmp.h: Check __cpp_lib_concepts before defining
concepts. Fix comment.
+ * include/bits/allocator.h
2019-10-25 Gerald Pfeifer <gerald@pfeifer.com>
_GLIBCXX20_CONSTEXPR
allocator(const allocator<_Tp1>&) _GLIBCXX_NOTHROW { }
- _GLIBCXX20_CONSTEXPR
+#if __cpp_constexpr_dynamic_alloc
+ constexpr
+#endif
~allocator() _GLIBCXX_NOTHROW { }
#if __cplusplus > 201703L
--- /dev/null
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <memory>
+
+constexpr bool f()
+{
+ std::allocator<int> a;
+ return std::allocator_traits<std::allocator<int>>::max_size(a) > 0;
+}
+static_assert( f() );