[Issue 7757] New: Inout function with lazy inout parameter doesn't compile
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 23 19:03:45 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7757
Summary: Inout function with lazy inout parameter doesn't
compile
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: critical
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: hsteoh at quickfur.ath.cx
--- Comment #0 from hsteoh at quickfur.ath.cx 2012-03-23 19:04:06 PDT ---
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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list