[PATCH] D21717: [libcxx] [test] Make dtor_noexcept.pass.cpp tests more portable.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 18:38:21 PDT 2016


STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

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.

http://reviews.llvm.org/D21717

Files:
  test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
  test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
  test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
  test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
  test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
  test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
  test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
  test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
  test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
  test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
  test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
  test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
  test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
  test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21717.61875.patch
Type: text/x-patch
Size: 9133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160625/43c0b04d/attachment-0001.bin>


More information about the cfe-commits mailing list