1 //===----------------------------------------------------------------------===//
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 // UNSUPPORTED: c++98, c++03
11 
12 // <string>
13 
14 // basic_string<charT,traits,Allocator>&
15 //   operator=(basic_string<charT,traits,Allocator>&& str);
16 
17 #include <string>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
main()22 int main()
23 {
24   // Test that assignment from {} and {ptr, len} are allowed and are not
25   // ambiguous.
26   {
27     std::string s = "hello world";
28     s = {};
29     assert(s.empty());
30   }
31   {
32     std::string s = "hello world";
33     s = {"abc", 2};
34     assert(s == "ab");
35   }
36 }
37