blob: 8b498f1787bdc0adda587ca8c373db750384b4d6 [file] [log] [blame]
Eric Fiselier37b2be92017-01-17 22:10:32 +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// 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
22int 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}