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& operator=(initializer_list<charT> il); // constexpr since C++20
14 
15 #include <string>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "min_allocator.h"
20 
test()21 TEST_CONSTEXPR_CXX20 bool test() {
22   {
23     std::string s;
24     s = {'a', 'b', 'c'};
25     assert(s == "abc");
26   }
27   {
28     typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
29     S s;
30     s = {'a', 'b', 'c'};
31     assert(s == "abc");
32   }
33 
34   return true;
35 }
36 
main(int,char **)37 int main(int, char**)
38 {
39   test();
40 #if TEST_STD_VER > 17
41   static_assert(test());
42 #endif
43 
44   return 0;
45 }
46