Bug 12524 – wrong type with inout const arg and inout return
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-05T03:57:00Z
Last change time
2014-04-15T16:34:12Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2014-04-05T03:57:10Z
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)).