[Issue 20428] Precondition bug for in/out
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 12 10:39:51 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=20428
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |contracts
CC| |dkorpel at live.nl
Hardware|x86_64 |All
OS|Linux |All
Severity|critical |enhancement
--- Comment #3 from Dennis <dkorpel at live.nl> ---
Not a bug, derived classes must tighten the outputs but can loosen the inputs:
https://dlang.org/spec/function.html#in_out_inheritance
Running checks on derived classes would break valid code.
Changing this to an enhancement "copy parent's contracts by default" like
FeepingCreature suggested, though that might need a DIP since it's a breaking
change as well.
--
More information about the Digitalmars-d-bugs
mailing list