Fix std::string assignment ambiguity from braced initializer lists.
When support for `basic_string_view` was added to string it also
added new assignment operators from `basic_string_view`. These caused
ambiguity when assigning from a braced initializer. This patch fixes
that regression by making the basic_string_view assignment operator
rank lower in overload resolution by making it a template.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292276 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp b/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
new file mode 100644
index 0000000..8b498f1
--- /dev/null
+++ b/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <string>
+
+// basic_string<charT,traits,Allocator>&
+// operator=(basic_string<charT,traits,Allocator>&& str);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ // Test that assignment from {} and {ptr, len} are allowed and are not
+ // ambiguous.
+ {
+ std::string s = "hello world";
+ s = {};
+ assert(s.empty());
+ }
+ {
+ std::string s = "hello world";
+ s = {"abc", 2};
+ assert(s == "ab");
+ }
+}