language: C++ 4.7.2 (gcc-4.7.2)
date: 407 days 14 hours ago
link:
visibility: public
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
33
34
35
36
37
#include <stdlib.h>
#include <iostream>
 
void* qq;
 
struct a
{
  virtual ~a(){ std::cout << "dtor called" << std::endl; };
 
  void* operator new[] (size_t s)
  {
    void* p = malloc(s);
    qq = p;
    return p;
  }
 
  void operator delete[] (void* p)
  {
    free(p);
  }
};
 
struct b
{
  int x;
};
 
struct c: b, a
{
  int y;
};
 
int main ()
{
  c* cc = new c[10];
  a::operator delete[] (qq);
}