brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 244fef8 Raw
54 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// <deque>10 11// deque()12//        noexcept(is_nothrow_default_constructible<allocator_type>::value);13 14// This tests a conforming extension15 16// UNSUPPORTED: c++0317 18#include <deque>19#include <cassert>20 21#include "test_macros.h"22#include "MoveOnly.h"23#include "test_allocator.h"24 25template <class T>26struct some_alloc {27  typedef T value_type;28  some_alloc(const some_alloc&);29  void allocate(std::size_t);30};31 32int main(int, char**) {33#if defined(_LIBCPP_VERSION)34  {35    typedef std::deque<MoveOnly> C;36    static_assert(std::is_nothrow_default_constructible<C>::value, "");37  }38  {39    typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;40    static_assert(std::is_nothrow_default_constructible<C>::value, "");41  }42#endif // _LIBCPP_VERSION43  {44    typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;45    static_assert(!std::is_nothrow_default_constructible<C>::value, "");46  }47  {48    typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;49    static_assert(!std::is_nothrow_default_constructible<C>::value, "");50  }51 52  return 0;53}54