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++98, c++03 10 11 // <string> 12 13 // basic_string(basic_string&&) 14 // noexcept(is_nothrow_move_constructible<allocator_type>::value); 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 24 int main() 25 { 26 { 27 typedef std::string C; 28 static_assert(std::is_nothrow_move_constructible<C>::value, ""); 29 } 30 { 31 typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C; 32 static_assert(std::is_nothrow_move_constructible<C>::value, ""); 33 } 34 { 35 typedef std::basic_string<char, std::char_traits<char>, limited_allocator<char, 10>> C; 36 #if TEST_STD_VER <= 14 37 static_assert(!std::is_nothrow_move_constructible<C>::value, ""); 38 #else 39 static_assert( std::is_nothrow_move_constructible<C>::value, ""); 40 #endif 41 } 42 } 43