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-exception
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03
10
11// <string>
12
13// basic_string(basic_string&&)
14// noexcept(is_nothrow_move_constructible<allocator_type>::value); // constexpr since C++20
15
16// This tests a conforming extension
17
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 <= 14
36 static_assert(!std::is_nothrow_move_constructible<C>::value, "");
37#else
38 static_assert(std::is_nothrow_move_constructible<C>::value, "");
39#endif
40 }
41
42 return 0;
43}
44

source code of libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp