www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13009] New: inout overload conflicts with non-inout when used

https://issues.dlang.org/show_bug.cgi?id=13009

          Issue ID: 13009
           Summary: inout overload conflicts with non-inout when used via
                    alias this
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com
            Blocks: 12368

From
https://github.com/D-Programming-Language/phobos/pull/2011#issuecomment-38431708:

///////// test.d ////////
struct T
{
    void put(char c) {}
}

struct S
{
    T t;

     property
    T getT()
    {
        return t;
    }

     property
    inout(T) getT() inout
    {
        return t;
    }

    alias getT this;
}

alias Sput = S.put;
/////////////////////////

This produces the errors:

test.d(25,1): Error: test.S.getT called with argument types () matches both:
test.d(11,7):     test.S.getT()
and:
test.d(17,14):     test.S.getT()

If this is not a compiler bug, then the implementation of RefCounted needs to
be changed to account for this behavior.

--
Jun 30 2014