This is an archive of the discontinued LLVM Phabricator instance.

[pair] Mark constructors as conditionally noexcept
ClosedPublic

Authored by ldionne on Jun 27 2018, 1:18 PM.

Details

Summary

std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

Note:
I did not add support in the explicit and non-explicit pair(_Tuple&& __p)
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

rdar://problem/29537079

Diff Detail

Repository
rCXX libc++

Event Timeline

ldionne created this revision.Jun 27 2018, 1:18 PM
dexonsmith edited subscribers, added: libcxx-commits; removed: llvm-commits.Oct 4 2018, 5:53 PM

I checked both N4788 and N4788, and couldn't find any conditional noexcept on the constructors of pair.
Just explicit(see below) constexpr pair(const T1& x, const T2& y);

So I'm assuming that this is a conforming extension.
If so, I'm ok with that - but then the tests need to be libc++ specific.
They can either be split out and the new parts moved into test/libcxx, or the static_asserts can be changed to LIBCPP_STATIC_ASSERTs.
Given the amount of new tests, I'm leaning towards the first option.

I checked both N4788 and N4788, and couldn't find any conditional noexcept on the constructors of pair.
Just explicit(see below) constexpr pair(const T1& x, const T2& y);

So I'm assuming that this is a conforming extension.
If so, I'm ok with that - but then the tests need to be libc++ specific.

Yes, it is an extension. Sorry, I should have caught that myself. This patch dates from a while back when I still didn't know the difference between test/libcxx and test/std. I'll fix it.

ldionne updated this revision to Diff 177053.Dec 6 2018, 2:21 PM

Split libc++ specific tests into test/libcxx

mclow.lists accepted this revision.Dec 10 2018, 5:42 PM

This LGTM now.

This revision is now accepted and ready to land.Dec 10 2018, 5:42 PM
This revision was automatically updated to reflect the committed changes.