[cfe-commits] Initializer bug with fix?

Eli Friedman eli.friedman at gmail.com
Sat Jan 14 16:24:48 PST 2012


On Sat, Jan 14, 2012 at 2:47 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> While chasing butterflies recently, I noticed the code generated by
> clang didn't match what was created by MSVC and ICC (but does match
> what gcc was emitting).  Here's a simplified C++ example:
>
> void *operator new( unsigned int size );  // note, non-throwing

Per [basic.stc.dynamic.allocation]p3, an operator new which isn't
marked throw() or noexcept is required to either succeed or throw an
exception matching std::bad_alloc.  clang takes advantage of this by
skipping the null check.

Do you have some specific concern about code which doesn't follow the standard?

-Eli




More information about the cfe-commits mailing list