Bug 8134 – Arguments getting nonsensical values in out contract when method is final
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-23T06:14:00Z
Last change time
2014-09-12T09:47:56Z
Keywords
contracts, wrong-code
Assigned to
nobody
Creator
alex
Comments
Comment #0 by alex — 2012-05-23T06:14:34Z
The following code is broken:
void main()
{
auto foo = new class
{
final Object doNothing(Object obj)
out (result) { assert (result is obj); }
body {
return obj;
}
};
foo.doNothing(null);
}
The 'obj' parameter is set to some nonsensical value when doNothing() is marked final. Remove the final and it works as expected.
Comment #1 by yebblies — 2014-09-12T09:47:56Z
*** This issue has been marked as a duplicate of issue 9746 ***