August 19, 2013 [Issue 10850] New: Inout substituted incorrectly for delegates in inout function signature | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10850 Summary: Inout substituted incorrectly for delegates in inout function signature Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: timon.gehr@gmx.ch --- Comment #0 from timon.gehr@gmx.ch 2013-08-19 02:49:22 PDT --- git head: Since apparently inout now refers to the outermost inout function, inout should also be substituted for delegates inside the function signature: inout(int)* delegate(inout(int)*) foo(ref inout(int) x){ inout(int)* bar(inout(int)*) { return &x; } return &bar; } immutable(int) x; static assert(is(typeof(foo(x))==immutable(int)* delegate(immutable(int)*))); (Also note that none of the recent language updates towards type safe inout checking were documented.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 19, 2013 [Issue 10850] Inout substituted incorrectly for delegates/fptrs in inout function signature | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=10850 timon.gehr@gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Inout substituted |Inout substituted |incorrectly for delegates |incorrectly for |in inout function signature |delegates/fptrs in inout | |function signature --- Comment #1 from timon.gehr@gmx.ch 2013-08-19 02:57:40 PDT --- Other test case: inout(int)* foo(inout(int)* a, inout(int)* delegate(inout(int)*) dg){ return dg(a); } inout(int)* bar(inout(int)* a, inout(int)* delegate(inout(int)*) dg){ auto x = dg(a); int* y; dg(y); return x; } void main(){ immutable int a; assert(foo(&a,x=>x) is &a); // error static assert(is(typeof(foo(&a,x=>x))==immutable(int)*)); // error assert(foo(&a,(immutable(int)* x)=>x) is &a); // error } This should compile. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation