On Wed, 8 Apr 2020 at 08:35, Richard Biener wrote: > Ah, so __builtin_operator_new isn't a function but an alternate > new expression syntax?
No, not a new-expression, because a new-expression calls operator new to obtain storage *and* begins the lifetime of one or more objects in that storage. __builtin_operator_new is just the first part, i.e. the operator new(...) call. But because explicit calls to operator new(...) are not supposed to be optimized, __builtin_operator_new is a way of calling operator new(...) that tells the compiler "this isn't an explicit call, you can optimise it". So a new-expression can use it (because that needs to call operator new(...), but the call should be optimisable) and std::allocator<T>::allocate(n) can use it (because that call is also optimisable).