[libcxx-commits] [libcxx] [libc++] Use correct size for deallocation of arrays in shared_ptr (PR #68233)
Ilya Biryukov via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Oct 5 02:42:26 PDT 2023
================
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// REQUIRES: -fsized-deallocation
+// ADDITIONAL_COMPILE_FLAGS: -fsized-deallocation
+
+// This test will fail with ASan if the implementation passes different sizes
+// to corresponding allocation and deallocation functions.
+
+#include <memory>
+
+int main() {
+ std::allocate_shared<int64_t[]>(std::allocator<int64_t>{}, 10);
+ std::make_shared<int64_t[]>(10);
+
+ std::allocate_shared<int64_t[10]>(std::allocator<int64_t>{});
+ std::make_shared<int64_t[10]>();
+}
----------------
ilya-biryukov wrote:
Done.
https://github.com/llvm/llvm-project/pull/68233
More information about the libcxx-commits
mailing list