brintos

brintos / llvm-project-archived public Read only

0
0
Text · 919 B · 6986788 Raw
21 lines · cpp
1// RUN: %check_clang_tidy %s misc-new-delete-overloads %t -- -- -fsized-deallocation2 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 delete8};9 10struct T {11  // Because we have enabled sized deallocations explicitly, this new/delete12  // pair matches.13  void *operator new(size_t size) noexcept;14  void operator delete(void *ptr, size_t) noexcept; // ok because sized deallocation is enabled15};16 17// While we're here, check that global operator delete with no operator new18// is also matched.19// CHECK-MESSAGES: :[[@LINE+1]]:6: warning: declaration of 'operator delete' has no matching declaration of 'operator new' at the same scope20void operator delete(void *ptr) noexcept;21