[Issue 17929] New: [Contract Programming] 23.3 In, Out and Inheritance
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Oct 23 04:45:21 UTC 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17929
          Issue ID: 17929
           Summary: [Contract Programming] 23.3 In, Out and Inheritance
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: resmith5 at outlook.com
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
--
    
    
More information about the Digitalmars-d-bugs
mailing list