www.digitalmars.com         C & C++   DMDScript  

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


           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

--- Comment #0 from Martin Nowak <code dawg.eu> 2014-04-05 03:57:10 PDT ---
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)));

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