1 // 5.3.4/19: If the lookup finds the two-parameter form of a usual 2 // deallocation function (3.7.4.2) and that function, considered as a 3 // placement deallocation function, would have been selected as a match for 4 // the allocation function, the program is ill-formed. 5 6 // But we should only complain about using op delete (void *, size_t) for 7 // placement delete if it would also be selected for normal delete, not if 8 // there's also an op delete (void *). 9 10 typedef __SIZE_TYPE__ size_t; 11 12 struct A 13 { 14 A(); 15 void* operator new (size_t, size_t); 16 void operator delete (void *, size_t); // { dg-message "non-placement" } 17 }; 18 19 struct B 20 { 21 B(); 22 void * operator new (size_t); 23 void * operator new (size_t, size_t); 24 void operator delete (void *); 25 void operator delete (void *, size_t); 26 }; 27 main()28int main() 29 { 30 A* ap = new (24) A; // { dg-error "placement" } 31 B* bp = new (24) B; 32 } 33