[libcxx-commits] [libcxx] [ASan][libc++] Annotating `std::basic_string` with all allocators (PR #75845)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 9 17:30:10 PST 2024


================
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: asan
+// UNSUPPORTED: c++03
+
+// <string>
+
+// Test based on: https://bugs.chromium.org/p/chromium/issues/detail?id=1419798#c5
+// Some allocators during deallocation may not call destructors and just reuse memory.
----------------
frederick-vs-ja wrote:

> If we really do mean "There's code that reuses the memory of live objects without destroying them", then that's exactly the kind of bug ASAN is meant to catch. That is not UB we should accept.

This might by considered as UB in the past, but is not UB now per [CWG2523](https://cplusplus.github.io/CWG/issues/2523.html).

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


More information about the libcxx-commits mailing list