1// RUN: %check_clang_tidy %s misc-new-delete-overloads %t -- -- -fsized-deallocation
2
3typedef decltype(sizeof(int)) size_t;
4
5struct S {
6 // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: declaration of 'operator delete' has no matching declaration of 'operator new' at the same scope [misc-new-delete-overloads]
7 void operator delete(void *ptr, size_t) noexcept; // not a placement delete
8};
9
10struct T {
11 // Because we have enabled sized deallocations explicitly, this new/delete
12 // pair matches.
13 void *operator new(size_t size) noexcept;
14 void operator delete(void *ptr, size_t) noexcept; // ok because sized deallocation is enabled
15};
16
17// While we're here, check that global operator delete with no operator new
18// is also matched.
19// CHECK-MESSAGES: :[[@LINE+1]]:6: warning: declaration of 'operator delete' has no matching declaration of 'operator new' at the same scope
20void operator delete(void *ptr) noexcept;
21

source code of clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads-sized-dealloc.cpp