libstdc++: Make ranges::construct_at constexpr-friendly [PR95788]
authorPatrick Palka <ppalka@redhat.com>
Thu, 8 Oct 2020 22:10:05 +0000 (18:10 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 8 Oct 2020 22:10:05 +0000 (18:10 -0400)
commit9158a4d2a6cd58d6bb591d5ce64e766b399e4aef
tree656f664ff2891cf51daf7ec0db1d1b5287a139bd
parent1c56c143b2011080d8a4516f37f78f647b0ee258
libstdc++: Make ranges::construct_at constexpr-friendly [PR95788]

This rewrites ranges::construct_at in terms of std::construct_at so
that we can piggyback on the compiler's existing support for
intercepting placement new within std::construct_at during constexpr
evaluation, instead of having to additionally teach the compiler about
ranges::construct_at.

While we're making changes to ranges::construct_at, this patch also
declares it conditionally noexcept and qualifies the calls to declval in
its requires-clause.

libstdc++-v3/ChangeLog:

PR libstdc++/95788
* include/bits/ranges_uninitialized.h:
(__construct_at_fn::operator()): Rewrite in terms of
std::construct_at.  Declare it conditionally noexcept.  Qualify
calls to declval in its requires-clause.
* testsuite/20_util/specialized_algorithms/construct_at/95788.cc:
New test.
libstdc++-v3/include/bits/ranges_uninitialized.h
libstdc++-v3/testsuite/20_util/specialized_algorithms/construct_at/95788.cc [new file with mode: 0644]