[Issue 5700] New: Allow dup in nothrow functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 4 15:12:49 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5700

           Summary: Allow dup in nothrow functions
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-03-04 15:09:52 PST ---
In DMD 2.052 it's allowed to create a new dynamic array inside nothrow
functions, this compiles and works:


nothrow void foo(int[] a) {
    auto b = new int[a.length];
    b[] = a[];
}
void main() {}


But this almost equivalent code isn't accepted:


nothrow void foo(int[] a) {
    a.dup;
}
void main() {}


DMD 2.052 shows:
test.d(2): Error: _adDupT is not nothrow
test.d(1): Error: function test.foo 'foo' is nothrow yet may throw

I suggest to let it accept the dup inside nothrow functions too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list