Dupping in a nothrow function?

Simen kjaeraas simen.kjaras at gmail.com
Fri Mar 4 14:37:05 PST 2011


bearophile <bearophileHUGS at lycos.com> wrote:

> It's now OK to create a new array in a nothrow function, but it seems  
> dup is not allowed:
>
>
> nothrow void foo(int[] a) {
>     a.dup;
> }
> void main() {}
>
>
> Errors with dmd 2.052, is this correct?
> test.d(2): Error: _adDupT is not nothrow
> test.d(1): Error: function test.foo 'foo' is nothrow yet may throw

It's probably correct that _adDupT is not nothrow. It is also wrong
that it shouldn't be.

-- 
Simen


More information about the Digitalmars-d-learn mailing list