[Issue 16417] New: override non-inout with inout
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Aug 23 02:03:10 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16417
Issue ID: 16417
Summary: override non-inout with inout
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: spec
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: lodovico at giaretart.net
CC: lodovico at giaretart.net
For example,
T get()
should be overridable with
inout(T) get() inout
as the latter expands to
T get()
const(T) get() const
immutable(T) get() immutable
Other examples:
T get(T) can be overridden by inout(T) get(T) inout
or inout(T) get(inout T)
const(T) get(T) const by inout(T) get(T) inout
but not inout(T) get(inout T) inout
So, an inout method should be able to override a non-inout method if and only
if all occurrences of inout in the overrider correspond to occurrences of the
same mutability modifier in the overrided method.
--
More information about the Digitalmars-d-bugs
mailing list