aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tc1/dr127.C
blob: 4dddc6d77789b7c61486510b0090a520edd49ea4 (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
// { dg-do link }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR127: Ambiguity in description of matching deallocation function

#include <cstddef>
#include <new>

struct A 
{
  // placement new, but can be called through normal new syntax.
  void* operator new(std::size_t size, float = 0.0f)
  {
    return ::operator new(size);
  }

  // The matching deallocation function must be called, which means
  //  the placemente delete.
  void operator delete(void*);
  void operator delete(void*, float) {}

  A()
  { throw 5; }
};

int main()
{
  (void)new A;
}