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