brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · bf5d256 Raw
52 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <set>10 11// ~multiset() // implied noexcept;12 13// UNSUPPORTED: c++0314 15#include <cassert>16#include <set>17#include <type_traits>18 19#include "test_macros.h"20#include "MoveOnly.h"21#include "test_allocator.h"22 23template <class T>24struct some_comp {25  typedef T value_type;26  ~some_comp() noexcept(false);27  bool operator()(const T&, const T&) const { return false; }28};29 30int main(int, char**) {31  {32    typedef std::multiset<MoveOnly> C;33    static_assert(std::is_nothrow_destructible<C>::value, "");34  }35  {36    typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;37    static_assert(std::is_nothrow_destructible<C>::value, "");38  }39  {40    typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;41    static_assert(std::is_nothrow_destructible<C>::value, "");42  }43#if defined(_LIBCPP_VERSION)44  {45    typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;46    static_assert(!std::is_nothrow_destructible<C>::value, "");47  }48#endif // _LIBCPP_VERSION49 50  return 0;51}52