[Bug libstdc++/44647] std::nothrow and std::bad_alloc are coupled

redi at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 23 14:57:00 GMT 2010



------- Comment #1 from redi at gcc dot gnu dot org  2010-06-23 14:57 -------
(In reply to comment #0)
> The std::bad_alloc definitions should be placed into a
> separate file.

IIUC that wouldn't work, <new> is required to declare bad_alloc, so if
bad_alloc was moved to a separate file, the parts of the library which need
nothrow_t, new_handler and operator new etc. would still have to include <new>,
which would still have to include bad_alloc.

The way to achieve what you want is to put everything except bad_alloc in a
separate file, and include that file instead of <new> when bad_alloc is not
needed.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44647



More information about the Gcc-bugs mailing list