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 // <string>
10 
11 #include <cassert>
12 #include <string>
13 
14 struct Incomplete;
15 template<class T> struct Holder { T t; };
16 
17 template<class T>
18 struct Charlike {
19     char ch_;
20     Charlike(char ch) : ch_(ch) {}
21     operator char() const { return ch_; }
22 };
23 
24 int main(int, char**)
25 {
26     std::string s;
27     Charlike<Holder<Incomplete> > a[] = {'m', 'a', 'h', 'i'};
28     s.append(a, a+4);
29     s.assign(a, a+4);
30     s.insert(s.begin(), a, a+4);
31     s.replace(s.begin(), s.begin()+4, a, a+4);
32     assert(s == "mahimahi");
33 
34     return 0;
35 }
36