bug in new.h?
Matthias Klose
doko@cs.tu-berlin.de
Wed Nov 10 10:47:00 GMT 1999
[ This feature or bug was reported to the Debian bug tracking system;
please CC 44356@bugs.debian.org for replys.
See http://www.debian.org/Bugs/db/44/44356.html for the complete report]
The submitter of the bug reported:
> /usr/lib/gcc-lib/i386-linux/2.95.1/include/new lines 37.. are:
>
> // default placement versions of operator new
> inline void *operator new(size_t, void *place) throw() { return place; }
> inline void *operator new[](size_t, void *place) throw() { return place; }
>
> The use of inline definition here precludes me from defining my own new
> operators.
>
> I consider this a bug.
>
> I suggest the { return place; } bodies be removed, and the definition
> be moved somewhere less intrusive.
Another developer responded:
> I don't see how #44356 is a bug. It prevents him from defining his
> own two-argument new function in the default namespace; he can still
> define one in any class he chooses. If the function bodies were off
> in a library somewhere he would have to override them in order to
> redefine new, which is not a legal course of action in C++, as far
> as I know.
and the response of the bug submitter:
> Daniel Jacobowitz is mistaken, it prevents me from overriding an operator.
>
> As far as I'm aware, overriding an operator is perfectly legal in C++.
>
> I look at the draft C++ standard, here:
> http://www.cygnus.com:80/misc/wp/draft/lib-support.html#lib.new.delete
>
> And it says (of dyadic operator new):
> a C++ program may define a function with this function signature
> that displaces the default version defined by the C++ Standard
> library.
>
> So this library doesn't conform to the standard. Not a bug?
More information about the Gcc-bugs
mailing list