www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3924] New: nothrow ignored in some situations

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

           Summary: nothrow ignored in some situations
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-03-10 06:53:26 PST ---
The following programs compile and raise exceptions even if the
functions/delegates are marked as nothrow:

------------------

void main() {
    nothrow void delegate() c = { throw new Exception(""); };
    c();
}

------------------

nothrow auto foo() {
    throw new Exception("");
}
void main() {
    foo();
}

------------------

nothrow auto foo() {
    auto c = { throw new Exception(""); };
    c();
}
void main() {
    foo();
}

---------------------------------


While this code that looks correct doesn't compile:


pure void foo(pure nothrow void delegate(int) callable) {
    callable(5);
}
void main() {
    pure nothrow void bar(int x) {}
    foo(&bar);
}


With the first error:
test1.d(1): basic type expected, not pure

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 10 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3924


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla kyllingen.net


--- Comment #1 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2010-11-09
03:55:37 PST ---
(In reply to comment #0)
 While this code that looks correct doesn't compile:
 
 
 pure void foo(pure nothrow void delegate(int) callable) {
     callable(5);
 }
 
 [...]
 
 With the first error:
 test1.d(1): basic type expected, not pure

Note that this works: pure void foo(void delegate(int) pure nothrow callable) { callable(5); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2010