brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 5bdae01 Raw
61 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// <vector>10 11// vector(vector&&)12//        noexcept(is_nothrow_move_constructible<allocator_type>::value);13 14// This tests a conforming extension15 16// UNSUPPORTED: c++0317 18#include <cassert>19#include <vector>20#include <type_traits>21 22#include "test_macros.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};30 31int main(int, char**) {32#if defined(_LIBCPP_VERSION)33  {34    typedef std::vector<bool> C;35    static_assert(std::is_nothrow_move_constructible<C>::value, "");36  }37  {38    typedef std::vector<bool, test_allocator<bool>> C;39    static_assert(std::is_nothrow_move_constructible<C>::value, "");40  }41  {42    typedef std::vector<bool, other_allocator<bool>> C;43    static_assert(std::is_nothrow_move_constructible<C>::value, "");44  }45#endif // _LIBCPP_VERSION46  {47    //  In C++17, move constructors for allocators are not allowed to throw48#if TEST_STD_VER > 1449#  if defined(_LIBCPP_VERSION)50    typedef std::vector<bool, some_alloc<bool>> C;51    static_assert(std::is_nothrow_move_constructible<C>::value, "");52#  endif // _LIBCPP_VERSION53#else54    typedef std::vector<bool, some_alloc<bool>> C;55    static_assert(!std::is_nothrow_move_constructible<C>::value, "");56#endif57  }58 59  return 0;60}61