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)).
Comment #1 by k.hara.pg — 2014-04-15T13:57:02Z
Comment #2 by github-bugzilla — 2014-04-15T16:34:12Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/31a86edabc9dbb775ce6eaaa77c28a639a928f6a fix Issue 12524 - wrong type with inout const arg and inout return https://github.com/D-Programming-Language/dmd/commit/6b238b36662ff0922cd09979e28a318b35ca97c7 Merge pull request #3457 from 9rnsr/fix12524 Issue 12524 - wrong type with inout const arg and inout return