[libcxx] r228927 - Remove undefined behavior from test; specifically, compare(NULL, XXX, 0). Thanks to Eric for the catch

Marshall Clow mclow.lists at gmail.com
Thu Feb 12 07:21:20 PST 2015


Author: marshall
Date: Thu Feb 12 09:21:20 2015
New Revision: 228927

URL: http://llvm.org/viewvc/llvm-project?rev=228927&view=rev
Log:
Remove undefined behavior from test; specifically, compare(NULL, XXX, 0). Thanks to Eric for the catch

Modified:
    libcxx/trunk/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp

Modified: libcxx/trunk/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp?rev=228927&r1=228926&r2=228927&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/string.view/string.view.ops/to_string.pass.cpp Thu Feb 12 09:21:20 2015
@@ -41,13 +41,12 @@ void test ( const CharT *s ) {
     const std::experimental::basic_string_view<CharT> sv1;
     String                                            str1 = (String) sv1;
 
+    assert ( sv1.size() == 0);
     assert ( sv1.size() == str1.size ());
-    assert ( std::char_traits<CharT>::compare ( sv1.data(), str1.data(), sv1.size()) == 0 );
 
 #if __cplusplus >= 201103L
     auto str2 = sv1.to_string(min_allocator<CharT>());
     assert ( sv1.size() == str2.size ());
-    assert ( std::char_traits<CharT>::compare ( sv1.data(), str2.data(), sv1.size()) == 0 );
 #endif
     }
 }





More information about the cfe-commits mailing list