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
26 lines
514 B
C
26 lines
514 B
C
// Build don't link:
|
|
// GROUPS passed visibility
|
|
// visibility file
|
|
// From: wpsun4!xinforms!johnjo@uunet.uu.net (John D. Johnson)
|
|
// Date: Wed, 4 Aug 93 13:25:25 MDT
|
|
// Subject: Access to private 'operator new()'
|
|
// Message-ID: <9308041925.AA09825@xinforms.wpunix
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
|
|
class X {
|
|
private:
|
|
void* operator new(size_t) throw(){// ERROR - .*
|
|
printf("Inside private new().\n");
|
|
return NULL;
|
|
}
|
|
public:
|
|
X() {}
|
|
};
|
|
|
|
|
|
int main(void)
|
|
{
|
|
X* p = new X;// ERROR - .*
|
|
}
|