1 // Test for C++14 sized deallocation. The operators delete defined below
2 // should be called only in C++14 mode and above.
5 extern "C" void abort();
6 typedef __SIZE_TYPE__ size_t;
10 void operator delete[] (void *p, size_t s) throw()
13 operator delete[] (p);
16 void operator delete (void *p, size_t s) throw()
22 void operator delete[] (void *p, size_t s, const std::nothrow_t &) throw()
25 operator delete[] (p);
28 void operator delete (void *p, size_t s, const std::nothrow_t &) throw()
40 struct D { ~D(){}; D() { throw 1; } };
44 /* * If the type is complete and if, for the second alternative (delete
45 array) only, the operand is a pointer to a class type with a
46 non-trivial destructor or a (possibly multi-dimensional) array
47 thereof, the function with two parameters is selected.
49 * Otherwise, it is unspecified which of the two deallocation functions
52 if (called != (__cplusplus >= 201402L)) abort(); called = false;
55 if (called != (__cplusplus >= 201402L)) abort(); called = false;
58 if (called != (__cplusplus >= 201402L)) abort(); called = false;
61 if (called != (__cplusplus >= 201402L)) abort(); called = false;
63 /* N3778 added the sized placement deallocation functions, but the core
64 language rules don't provide any way they would be called. */
65 try { new (std::nothrow) D; } catch (int) {}
68 try { new (std::nothrow) D[2]; } catch (int) {}
71 /* Make sure we don't try to use the size of an array that doesn't have a