brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 052b032 Raw
57 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()12//    noexcept(13//        is_nothrow_default_constructible<allocator_type>::value &&14//        is_nothrow_default_constructible<key_compare>::value &&15//        is_nothrow_copy_constructible<key_compare>::value);16 17// This tests a conforming extension18 19// UNSUPPORTED: c++0320 21#include <set>22#include <cassert>23 24#include "test_macros.h"25#include "MoveOnly.h"26#include "test_allocator.h"27 28template <class T>29struct some_comp {30  typedef T value_type;31  some_comp();32  bool operator()(const T&, const T&) const { return false; }33};34 35int main(int, char**) {36#if defined(_LIBCPP_VERSION)37  {38    typedef std::multiset<MoveOnly> C;39    static_assert(std::is_nothrow_default_constructible<C>::value, "");40  }41  {42    typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;43    static_assert(std::is_nothrow_default_constructible<C>::value, "");44  }45#endif // _LIBCPP_VERSION46  {47    typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;48    static_assert(!std::is_nothrow_default_constructible<C>::value, "");49  }50  {51    typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;52    static_assert(!std::is_nothrow_default_constructible<C>::value, "");53  }54 55  return 0;56}57