[libcxx] r325740 - Add another test case to the deduction guide for basic_string.

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 21 21:14:20 PST 2018


Author: marshall
Date: Wed Feb 21 21:14:20 2018
New Revision: 325740

URL: http://llvm.org/viewvc/llvm-project?rev=325740&view=rev
Log:
Add another test case to the deduction guide for basic_string.

Modified:
    libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp

Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp?rev=325740&r1=325739&r2=325740&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp Wed Feb 21 21:14:20 2018
@@ -41,6 +41,17 @@ int main()
 {
     {
     const char* s = "12345678901234";
+    std::basic_string s1(s, s+10);  // Can't use {} here
+    using S = decltype(s1); // what type did we get?
+    static_assert(std::is_same_v<S::value_type,                      char>,  "");
+    static_assert(std::is_same_v<S::traits_type,    std::char_traits<char>>, "");
+    static_assert(std::is_same_v<S::allocator_type,   std::allocator<char>>, "");
+    assert(s1.size() == 10);
+    assert(s1.compare(0, s1.size(), s, s1.size()) == 0);
+    }
+
+    {
+    const char* s = "12345678901234";
     std::basic_string s1{s, s+10, std::allocator<char>{}};
     using S = decltype(s1); // what type did we get?
     static_assert(std::is_same_v<S::value_type,                      char>,  "");




More information about the cfe-commits mailing list