www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12524] New: wrong type with inout const arg and inout return

https://d.puremagic.com/issues/show_bug.cgi?id=12524

           Summary: wrong type with inout const arg and inout return
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu



cat > bug.d << CODE
inout(int) dup(inout(const(int)) val)
{
    return val;
}

pragma(msg, typeof(dup));

void foo(inout(int))
{
    inout(const(int)) val;
    auto bug = dup(val);
    pragma(msg, typeof(bug));
    static assert(is(typeof(bug) == inout(int)));
}
CODE

dmd -c bug
----
Error: static assert  (is(inout(const(int)) == inout(int))) is false
----

Interestingly enough the type of the function is correct, but the type of the
call expression remains inout(const(int)).

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2014