c++: constantness of call to function pointer [PR111703]
[official-gcc.git] / gcc / testsuite / g++.dg / pr94314-4.C
blobfd3b9c762f20510b5ec717e4f4e7fa0bb1b60d1c
1 /* PR c++/94314.  */
2 /* { dg-do run { target c++14 } } */
3 /* { dg-options "-O2 -fdump-tree-cddce-details -fdelete-null-pointer-checks" } */
5 int count = 0;
7 __attribute__((malloc, noinline)) void* operator new[](__SIZE_TYPE__ sz) {
8   ++count;
9   return ::operator new(sz);
12 void operator delete[](void* ptr) noexcept {
13   --count;
14   ::operator delete(ptr);
17 void operator delete[](void* ptr, __SIZE_TYPE__ sz) noexcept {
18   --count;
19   ::operator delete(ptr, sz);
22 int main() {
23   delete[] new int[1];
24   if (count != 0)
25     __builtin_abort ();
27   return 0;
30 /* { dg-final { scan-tree-dump-not "Deleting : operator delete" "cddce1"} } */