digitalmars.D.bugs - [Issue 11936] New: Allow non-`ref` parameters in `foreach` over range `delegate`/`opApply`
- d-bugmail puremagic.com (30/30) Jan 16 2014 https://d.puremagic.com/issues/show_bug.cgi?id=11936
https://d.puremagic.com/issues/show_bug.cgi?id=11936 Summary: Allow non-`ref` parameters in `foreach` over range `delegate`/`opApply` Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: verylonglogin.reg gmail.com 12:05:21 MSK --- Test code: --- void main() { int delegate(int delegate(int)) dg1; // currently unforeachable int delegate(int delegate(ref int)) dg2; static assert( __traits(compiles, { foreach( a; dg1) { } })); // fails static assert(!__traits(compiles, { foreach(ref a; dg1) { } })); static assert( __traits(compiles, { foreach(ref a; dg2) { } })); } --- As some parameters may represent e.g. temporary values it's useful to show it disallowing `ref` on them. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 16 2014