This is the mail archive of the
mailing list for the GCC project.
Re: an interesting g++ new/delete bug -- only defining half the set
- To: brendan at cygnus dot com, egcs-bugs at cygnus dot com
- Subject: Re: an interesting g++ new/delete bug -- only defining half the set
- From: mrs at wrs dot com (Mike Stump)
- Date: Wed, 26 Aug 1998 13:43:29 -0700
> From: Brendan Kehoe <firstname.lastname@example.org>
> Date: Tue, 25 Aug 1998 19:50:41 -0700 (PDT)
> To: email@example.com
> What it will very subtly do is call your redefined operator new, but
> then call your builtin operator delete.
> Any thoughts on a productive way to make the compiler see that this is
> happening, and suitably warn about it?
Sure, all you have to do is a link time analysis package that ensures
either both new and delete come from user land, or come from the
system library, but not both. If you wanted a hard error, you can put
new and delete in one object. The user would get link errors about
redefs if they failed do this.
> Like have both build_new and build_delete do a DECL_BUILT_IN check
> between what would be called for that type, versus what will
> probably be used for its opposite? Hmm...
Nope, in general this can't work. In a very limited case, it can
catch some things.