[Issue 7803] New: scope(success) in nothrow/@safe functions causes	compile errors
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Mar 31 05:19:00 PDT 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=7803
           Summary: scope(success) in nothrow/@safe functions causes
                    compile errors
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: david.eckardt at sociomantic.com
--- Comment #0 from David Eckardt <david.eckardt at sociomantic.com> 2012-03-31 05:19:31 PDT ---
Example code:
---
module test;
@safe int f() {
    scope(success) {/* ... */}
    return 3;
}
nothrow int g() {
    scope(success) {/* ... */}
    return 3;
}
---
DMD reports these compile-time errors:
Error: can only catch class objects derived from Exception in @safe code, not
'object.Throwable'
Error: object.Throwable is thrown but not caught test.d(8): Error: function
test.g 'g' is nothrow yet may throw
When using scope(exit) instead, the example code compiles successfully.
-- 
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