[libcxx-dev] Sequence container swap noexcept specifiers not-to-spec

Christopher Di Bella via libcxx-dev libcxx-dev at lists.llvm.org
Thu Mar 4 09:24:40 PST 2021


Ah, I was looking for a big "Resolved" status and missed that.

So IIUC you're saying the conditional noexcept specifier is a relic
required by the Lakos rule, but is always true thanks to LWG2016, and an
allocator that throws in its swap in libc++ calls std::terminate, which is
our resolution to UB, and so everything is already A-OK.

On Thu, 4 Mar 2021, 09:16 Tim Song, <t.canens.cpp at gmail.com> wrote:

> On Thu, Mar 4, 2021 at 11:14 AM Christopher Di Bella <cjdb.ns at gmail.com>
> wrote:
> >
> >
> >
> > On Thu, 4 Mar 2021, 09:03 Tim Song, <t.canens.cpp at gmail.com> wrote:
> >>
> >> I don't think this is an oversight. The conditional noexcept on swap
> >> in the standard is entirely due to the Lakos rule (swapping containers
> >> with non-propagating unequal allocators is undefined), so the
> >> unconditional noexcept is a permissible strengthening. The
> >> __is_nothrow_swappable check pre-17 is presumably to support
> >> allocators with throwing swaps, which were banned by LWG2016.
> >>
> >> If a change is desirable, I would suggest treating LWG2016 as a DR and
> >> using unconditional noexcept across the board.
> >
> >
> > I see LWG2016 is P2 and hasn't been looked at since 2017. What would be
> necessary to get LWG to review this again?
> >
>
> It's in C++17 already?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20210304/7f9af168/attachment.html>


More information about the libcxx-dev mailing list