1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // basic_string& operator=(initializer_list<charT> il); // constexpr since C++20
18 #include "test_macros.h"
19 #include "min_allocator.h"
22 template <template <class> class Alloc
>
23 TEST_CONSTEXPR_CXX20
void test_string() {
25 typedef std::basic_string
<char, std::char_traits
<char>, Alloc
<char>> S
;
27 S
& result
= (s
= {'a', 'b', 'c'});
29 assert(&result
== &s
);
31 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
33 typedef std::basic_string
<wchar_t, std::char_traits
<wchar_t>, Alloc
<wchar_t>> S
;
35 S
& result
= (s
= {L
'a', L
'b', L
'c'});
37 assert(&result
== &s
);
43 TEST_CONSTEXPR_CXX20
bool test() {
44 test_string
<std::allocator
>();
45 test_string
<min_allocator
>();
50 int main(int, char**) {
53 static_assert(test());