[libcxx-commits] [libcxx] [ASan][libc++] std::basic_string annotations (PR #72677)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 5 08:08:22 PST 2023


================
@@ -18,18 +18,27 @@
 #include "test_macros.h"
 #include "test_allocator.h"
 #include "min_allocator.h"
+#include "asan_testing.h"
 
 // clang-format off
 template <template <class> class Alloc>
 TEST_CONSTEXPR_CXX20 void test_string() {
   {
     std::basic_string<char, std::char_traits<char>, Alloc<char> > s = {'a', 'b', 'c'};
     assert(s == "abc");
+    LIBCPP_ASSERT(is_string_asan_correct(s));
+  }
+  {
+    std::basic_string<char, std::char_traits<char>, Alloc<char> > s;
+    s = {'a', 'b', 'c'};
+    assert(s == "abc");
+    LIBCPP_ASSERT(is_string_asan_correct(s));
   }
----------------
ldionne wrote:

This is a test for the constructor, but you added a test case that checks the assignment operator from initializer list. I think this test case is just misplaced.

https://github.com/llvm/llvm-project/pull/72677


More information about the libcxx-commits mailing list