[Issue 15984] New: Interface contracts retrieve garbage instead of parameters
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon May 2 06:35:09 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15984
Issue ID: 15984
Summary: Interface contracts retrieve garbage instead of
parameters
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: contracts, wrong-code
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: verylonglogin.reg at gmail.com
Blocks: 7517
This code should run fine:
---
interface I
{
void f(int i)
in { assert(i == 5); } // Fails
}
class C : I
{
void f(int i)
in { } // To call contract
body { }
}
void main()
{
I i = new C;
i.f(5);
}
---
Note: `(new C).f(5)` fails too but let's support correct contract
implementation (i.e. contract is called based on static type) in testcase.
--
More information about the Digitalmars-d-bugs
mailing list