This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Make dtor_noexcept.pass.cpp tests more portable.
ClosedPublic

Authored by STL_MSFT on Jun 24 2016, 6:38 PM.

Details

Summary

Make dtor_noexcept.pass.cpp tests more portable.

They were static_asserting that in certain situations, the following things have throwing destructors:

ordered/unordered associative containers
non-array sequence containers (deque, forward_list, list, vector, vector<bool>)
basic_string

However, C++11 through N4594 17.6.5.12 [res.on.exception.handling]/4 says "Destructor operations defined in the C++ standard library shall not throw exceptions. Every destructor in the C++ standard library shall behave as if it had a non-throwing exception specification."

This is observable through is_nothrow_destructible, so I actually believe that both the libc++ product and tests are being non-conformant here.

MSVC's STL marks all destructors as unconditionally noexcept (permitted and indeed required by the Standardese quoted above), so these static_asserts are failing for us. Changing them to LIBCPP_STATIC_ASSERT resolves these failures.

Diff Detail

Event Timeline

STL_MSFT updated this revision to Diff 61875.Jun 24 2016, 6:38 PM
STL_MSFT retitled this revision from to [libcxx] [test] Make dtor_noexcept.pass.cpp tests more portable..
STL_MSFT updated this object.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.
EricWF requested changes to this revision.Jun 26 2016, 1:30 PM
EricWF edited edge metadata.

Please add the missing "test_macros.h" includes.

This revision now requires changes to proceed.Jun 26 2016, 1:30 PM
STL_MSFT updated this revision to Diff 62001.Jun 27 2016, 12:14 PM
STL_MSFT edited edge metadata.

Adding test_macros.h as requested.

EricWF accepted this revision.Jul 24 2016, 5:57 PM
EricWF edited edge metadata.

I think I'm happy with libc++'s behavior of automatically deducing the dtor exception specification. This patch LGTM.

This revision is now accepted and ready to land.Jul 24 2016, 5:57 PM
EricWF closed this revision.Jul 24 2016, 5:59 PM

r276595