https://issues.dlang.org/show_bug.cgi?id=3075
Bolpat <qs.il.paperi...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |qs.il.paperi...@gmail.com --- Comment #30 from Bolpat <qs.il.paperi...@gmail.com> --- Overriding with contravariant parameter types can work. Because D has overloading and contravariant overriding is factually indistinguishable from overloading, an annotation must be used to clarify: It could be as simple as giving override an optional type list that signifies the types of the parameters of the method to be overridden: Attribute: ... override + override Parameters class X {} class Y : X {} class C { void foo(Y y) {} } class D : C { override(Y) void foo(X x) {} // overrides foo(Y y) } It's similar to the VisibilityAttribute package with a QualifiedIdentifier to signify the exact package it should be visible from. It's very specific and one could argue that overloading and forwarding solves the issue in almost all cases. class D : C { override void foo(Y y) { foo(cast(X) y); } void foo(X x) { ... } } There might be very specific circumstances where this is not a viable option. --