1 // Ensure that operator new/delete are still replaceable using static-libsan.
3 // FIXME: Weak symbols aren't supported on Windows, although some code in
4 // compiler-rt already exists to solve this problem. We should probably define
5 // the new/delete interceptors as "weak" using those workarounds as well.
6 // UNSUPPORTED: target={{.*windows.*}}
8 // darwin only supports `shared-libsan`.
9 // REQUIRES: asan-static-runtime
11 // RUN: %clangxx %s -o %t -fsanitize=address -static-libsan && not %run %t 2>&1 | FileCheck %s
17 void *operator new[](size_t size
) {
18 fprintf(stderr
, "replaced new\n");
22 void operator delete[](void *ptr
) noexcept
{
23 fprintf(stderr
, "replaced delete\n");
27 int main(int argc
, char **argv
) {
28 // CHECK: replaced new
29 char *x
= new char[5];
30 // CHECK: replaced delete
32 // CHECK: ERROR: AddressSanitizer