digitalmars.D.bugs - [Issue 17473] New: foreach on delegates incorrectly rejected
- via Digitalmars-d-bugs (30/30) Jun 06 2017 https://issues.dlang.org/show_bug.cgi?id=17473
https://issues.dlang.org/show_bug.cgi?id=17473 Issue ID: 17473 Summary: foreach on delegates incorrectly rejected Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: All Status: NEW Severity: normal Priority: P3 Component: dmd Assignee: nobody puremagic.com Reporter: eyal weka.io Here is an incorrect rejection of a valid program: struct S { int f(int delegate(char a) dlg) { char c = cast(char)50; return dlg(c); } } unittest { S s; pragma(msg, typeof(&s.f)); // int delegate(int delegate(char a) dlg) foreach(x; &s.f) {} int delegate(int delegate(char a) dlg) g = &s.f; pragma(msg, typeof(g)); // int delegate(int delegate(char a) dlg) foreach(x; g) {} // FAILS } --
Jun 06 2017