15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <set>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // ~multiset() // implied noexcept;
125a83710eSEric Fiselier 
13*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03
14f2f2a639SEric Fiselier 
155a83710eSEric Fiselier #include <set>
165a83710eSEric Fiselier #include <cassert>
175a83710eSEric Fiselier 
1893b8e51eSEric Fiselier #include "test_macros.h"
19949389c3SMarshall Clow #include "MoveOnly.h"
205a83710eSEric Fiselier #include "test_allocator.h"
215a83710eSEric Fiselier 
225a83710eSEric Fiselier template <class T>
235a83710eSEric Fiselier struct some_comp
245a83710eSEric Fiselier {
255a83710eSEric Fiselier     typedef T value_type;
265a83710eSEric Fiselier     ~some_comp() noexcept(false);
operator ()some_comp2754238fd3SMarshall Clow     bool operator()(const T&, const T&) const { return false; }
285a83710eSEric Fiselier };
295a83710eSEric Fiselier 
main(int,char **)302df59c50SJF Bastien int main(int, char**)
315a83710eSEric Fiselier {
325a83710eSEric Fiselier     {
335a83710eSEric Fiselier         typedef std::multiset<MoveOnly> C;
345a83710eSEric Fiselier         static_assert(std::is_nothrow_destructible<C>::value, "");
355a83710eSEric Fiselier     }
365a83710eSEric Fiselier     {
375a83710eSEric Fiselier         typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
385a83710eSEric Fiselier         static_assert(std::is_nothrow_destructible<C>::value, "");
395a83710eSEric Fiselier     }
405a83710eSEric Fiselier     {
415a83710eSEric Fiselier         typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
425a83710eSEric Fiselier         static_assert(std::is_nothrow_destructible<C>::value, "");
435a83710eSEric Fiselier     }
4403fe6e2dSStephan T. Lavavej #if defined(_LIBCPP_VERSION)
455a83710eSEric Fiselier     {
465a83710eSEric Fiselier         typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
4703fe6e2dSStephan T. Lavavej         static_assert(!std::is_nothrow_destructible<C>::value, "");
485a83710eSEric Fiselier     }
4903fe6e2dSStephan T. Lavavej #endif // _LIBCPP_VERSION
502df59c50SJF Bastien 
512df59c50SJF Bastien   return 0;
525a83710eSEric Fiselier }
53