www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16417] New: override non-inout with inout


          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 puremagic.com
          Reporter: lodovico giaretart.net
                CC: lodovico 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.

Aug 23 2016