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

           Summary: scope(failure) is not allowed in contracts
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: 2kor...@gmail.com


--- Comment #0 from Koroskin Denis <2kor...@gmail.com> 2009-10-14 07:40:55 PDT 
---
import std.stdio;

int sqrt(int i)
out (result)
{
    scope (failure) writeln("ooops");

    assert(result * result == i); 
}
body
{
    return i / 2;    // buggy implementation :)
}

Error: Throw statements cannot be in contracts

I'm not sure if it's a good idea to disallow throw statements in contracts:
It's so easy to overcome this restriction (by calling assert or any other
function that will throw) that I don't think it's worth the trouble.

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

Reply via email to