summaryrefslogtreecommitdiff
path: root/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp')
-rw-r--r--test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp36
1 files changed, 36 insertions, 0 deletions
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 000000000000..8b498f1787bd
--- /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");
+ }
+}