Bug 6058 – Contract inheritance causes compiler error

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2011-05-26T06:32:00Z
Last change time
2015-06-09T05:11:58Z
Keywords
contracts
Assigned to
nobody
Creator
mathias.baumann

Attachments

IDFilenameSummaryContent-TypeSize
990main2.dTest Case for Contract Inheritance Errortext/plain266

Comments

Comment #0 by mathias.baumann — 2011-05-26T06:32:44Z
Created attachment 990 Test Case for Contract Inheritance Error I am getting the error: main2.d(18): Error: cast(Object)__result is not an lvalue When using contracts with inheritance in certain cases. See the attached test-case for a demonstration of the problem
Comment #1 by clugdbug — 2012-11-19T03:39:07Z
Applies equally to D2, if you add the 'override' keyword: class Dummy {}; class Super { public Object test () out (obj) { } body { return new Dummy; } } class Example : Super { public override Dummy test ( ) { return cast(Dummy) super.test; } } void main ( ) { } -- D2 -- bug.d(16): Error: cast(const(Object))__result is not an lvalue
Comment #2 by henning — 2013-07-25T07:11:00Z
*** This issue has been marked as a duplicate of issue 10479 ***