nothrow functions/methods

Don nospam at nospam.com
Sun Feb 28 12:49:09 PST 2010


bearophile wrote:
> Daniel Murphy:
>> Allocations are allowed inside nothrow functions.  If I remember correctly, the reasons are that disallowing them would limit usefulness, and that OutOfMemoryError is not generally recoverable.<
> 
> OK. Then can you tell me why the following program produces:
> test2.d(1): Error: function test2.foo 'foo' is nothrow yet may throw
> 
> nothrow void foo() {
>     auto a = new int[5];
> }
> void main() {}
> 
> Bye,
> bearophile
That's clearly a bug.



More information about the Digitalmars-d mailing list