138590b38SEric Fiselier //===----------------------------------------------------------------------===//
238590b38SEric Fiselier //
3*57b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*57b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
5*57b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
638590b38SEric Fiselier //
738590b38SEric Fiselier //===----------------------------------------------------------------------===//
838590b38SEric Fiselier 
938590b38SEric Fiselier // UNSUPPORTED: c++98, c++03
1038590b38SEric Fiselier 
1138590b38SEric Fiselier // <string>
1238590b38SEric Fiselier 
1338590b38SEric Fiselier // basic_string<charT,traits,Allocator>&
1438590b38SEric Fiselier //   operator=(basic_string<charT,traits,Allocator>&& str);
1538590b38SEric Fiselier 
1638590b38SEric Fiselier #include <string>
1738590b38SEric Fiselier #include <cassert>
1838590b38SEric Fiselier 
1938590b38SEric Fiselier #include "test_macros.h"
2038590b38SEric Fiselier 
2138590b38SEric Fiselier int main()
2238590b38SEric Fiselier {
2338590b38SEric Fiselier   // Test that assignment from {} and {ptr, len} are allowed and are not
2438590b38SEric Fiselier   // ambiguous.
2538590b38SEric Fiselier   {
2638590b38SEric Fiselier     std::string s = "hello world";
2738590b38SEric Fiselier     s = {};
2838590b38SEric Fiselier     assert(s.empty());
2938590b38SEric Fiselier   }
3038590b38SEric Fiselier   {
3138590b38SEric Fiselier     std::string s = "hello world";
3238590b38SEric Fiselier     s = {"abc", 2};
3338590b38SEric Fiselier     assert(s == "ab");
3438590b38SEric Fiselier   }
3538590b38SEric Fiselier }
36