[Issue 3400] New: scope(failure) is not allowed in contracts
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 14 07:40:55 PDT 2009
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: nobody at puremagic.com
ReportedBy: 2korden at gmail.com
--- Comment #0 from Koroskin Denis <2korden at 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: -------
More information about the Digitalmars-d-bugs
mailing list