blob: b3cc127fbc46ce50ae57d5c416e5f4caaa885dbf [file] [log] [blame]
Howard Hinnant53f7d4c2011-06-03 18:40:47 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <string>
11
12// ~basic_string() // implied noexcept;
13
14#include <string>
15#include <cassert>
16
Marshall Clow1b921882013-12-03 00:18:10 +000017#include "test_allocator.h"
Howard Hinnant53f7d4c2011-06-03 18:40:47 +000018
Dan Albert1d4a1ed2016-05-25 22:36:09 -070019#if __has_feature(cxx_noexcept)
20
Howard Hinnant53f7d4c2011-06-03 18:40:47 +000021template <class T>
22struct some_alloc
23{
24 typedef T value_type;
25 some_alloc(const some_alloc&);
26 ~some_alloc() noexcept(false);
27};
28
Dan Albert1d4a1ed2016-05-25 22:36:09 -070029#endif
30
Howard Hinnant53f7d4c2011-06-03 18:40:47 +000031int main()
32{
Dan Albert1d4a1ed2016-05-25 22:36:09 -070033#if __has_feature(cxx_noexcept)
Howard Hinnant53f7d4c2011-06-03 18:40:47 +000034 {
35 typedef std::string C;
36 static_assert(std::is_nothrow_destructible<C>::value, "");
37 }
38 {
39 typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
40 static_assert(std::is_nothrow_destructible<C>::value, "");
41 }
42 {
43 typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
44 static_assert(!std::is_nothrow_destructible<C>::value, "");
45 }
Dan Albert1d4a1ed2016-05-25 22:36:09 -070046#endif
Howard Hinnant53f7d4c2011-06-03 18:40:47 +000047}