Debian Codegraph @

gcc/testsuite/g++.dg/tc1/dr127.C

raw
1 // { dg-do link }
2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR127: Ambiguity in description of matching deallocation function
4
5 #include <cstddef>
6 #include <new>
7
8 struct A
9 {
10 // placement new, but can be called through normal new syntax.
11 void* operator new(std::size_t size, float = 0.0f)
12 {
13 return ::operator new(size);
14 }
15
16 // The matching deallocation function must be called, which means
17 // the placemente delete.
18 void operator delete(void*);
19 void operator delete(void*, float) {}
20
21 A()
22 { throw 5; }
23 };
24
25 int main()
26 {
27 (void)new A;
28 }