Bug 7757 – Inout function with lazy inout parameter doesn't compile

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-23T19:04:00Z
Last change time
2013-01-22T09:44:19Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2012-03-23T19:04:06Z
Code: inout(int) func(int x, lazy inout(int) defaultVal) { return defaultVal; } void main() { int x = func(1,2); const(int) cx = func(1,2); } Compiler error: test2.d(4): Error: inout on return means inout must be on a parameter as well for pure @safe inout(int)() test2.d(8): Error: inout on return means inout must be on a parameter as well for inout(int)() test2.d(9): Error: inout on return means inout must be on a parameter as well for inout(int)() Clearly, this is wrong, because inout *is* on the second parameter. It's being masked by the "lazy", as can be proven by removing "lazy" and it will compile.
Comment #1 by k.hara.pg — 2012-03-24T12:08:31Z
Comment #2 by github-bugzilla — 2012-03-26T21:00:55Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e74a26ad05629d72d353552ef144ac69c3e9994a Merge pull request #836 from 9rnsr/fix7757 Issue 7757 - Inout function with lazy inout parameter doesn't compile
Comment #3 by github-bugzilla — 2013-01-22T09:44:19Z