www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3864] New: Dyn array allocations can be allowed in nothrow functions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3864

           Summary: Dyn array allocations can be allowed in nothrow
                    functions
           Product: D
           Version: 2.040
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This program performs a memory allocation, so it can throw an out of memory
error. But such exceptions are now meant to be not recoverable, so I think
allocating memory can now be done in nothrow functions too.

But currently with the following code the compiler prints at compile time:
test2.d(1): Error: function test2.foo 'foo' is nothrow yet may throw


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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3864


Michal Minich <michal.minich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michal.minich gmail.com



PST ---
similar cases:

does no compile
void foo1 () nothrow { auto x = [4]; }

compiles ok
void foo2 () nothrow { int[] x; x ~= 4; }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3864


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



Fixed svn 726.

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