brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · d807cac Raw
44 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// UNSUPPORTED: c++0310 11// <string>12 13// basic_string(basic_string&&)14//        noexcept(is_nothrow_move_constructible<allocator_type>::value); // constexpr since C++2015 16// This tests a conforming extension17 18#include <string>19#include <cassert>20 21#include "test_macros.h"22#include "test_allocator.h"23 24int main(int, char**) {25  {26    typedef std::string C;27    static_assert(std::is_nothrow_move_constructible<C>::value, "");28  }29  {30    typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;31    static_assert(std::is_nothrow_move_constructible<C>::value, "");32  }33  {34    typedef std::basic_string<char, std::char_traits<char>, limited_allocator<char, 10>> C;35#if TEST_STD_VER <= 1436    static_assert(!std::is_nothrow_move_constructible<C>::value, "");37#else38    static_assert(std::is_nothrow_move_constructible<C>::value, "");39#endif40  }41 42  return 0;43}44