Bug 17929 – [Contract Programming] 23.3 In, Out and Inheritance
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P3
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-10-23T04:45:21Z
Last change time
2017-10-23T06:14:27Z
Assigned to
No Owner
Creator
Rob
Comments
Comment #0 by resmith5 — 2017-10-23T04:45:21Z
The section says
"A function without an in contract means that any values of the function parameters are allowed. This implies that if any function in an inheritance hierarchy has no in contract, then in contracts on functions overriding it have no useful effect."
But it appears that a compile error is generated when an overridden function has an "in" and the function it is overriding does not, rather than the contract having no effect - a compile error is encountered:
contracts.d(34): Error: function contracts.TestContractsDerived.someFunction cannot have an in contract when overridden function contracts.TestContractsBase.someFunction does not have an in contract
makefile:77: recipe for target 'contracts' failed
Comment #1 by resmith5 — 2017-10-23T06:14:27Z
*** This issue has been marked as a duplicate of issue 17930 ***