Reputation: 15018
I was looking at a description of delete[]
and it says:
Exception safety
No-throw guarantee: this function never throws exceptions.
But it adds:
Notice that an invalid value of ptr causes undefined behavior.
I suspect that UB can include throwing an exception and the guarantee is only good for valid pointers, but I just thought I'd check.
Upvotes: 1
Views: 661
Reputation: 76523
"Undefined behavior" means that the language definition does not tell you what the code does. So, yes, anything can happen, including blowing past a noexcept
specifier. After all, there are no rules... (well, your compiler may provide rules, but relying on that is not portable).
Upvotes: 3