7f477e818a
* cp-tree.h (TYPE_NOTHROW_P): New macro. * decl2.c (delete_sanity): Warn on deleting void *. * init.c (build_new_1): Use TYPE_NOTHROW_P. * typeck.c (c_expand_return): cp_pedwarn on returning NULL from throwing operator new. From-SVN: r26692
23 lines
334 B
C
23 lines
334 B
C
// prms-id: 7330
|
|
#include <stddef.h>
|
|
int size = 0;
|
|
|
|
struct X {
|
|
int x;
|
|
void *operator new[](size_t sz) throw() {
|
|
size = sz;
|
|
return 0;
|
|
}
|
|
void operator delete[] (void *vp) { ::operator delete(vp); }
|
|
};
|
|
int main()
|
|
{
|
|
X (*px) [10];
|
|
|
|
px = new X[5][10];
|
|
|
|
delete [] px;
|
|
|
|
return 0;
|
|
}
|