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
next sibling 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
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3924


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-25
13:23:45 PST ---
The workaround for all of these is to put the attributes after the function
parameter list. When it's on the left side the compiler seems to ignore it,
this of course has to be fixed.

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