June 06, 2017 [Issue 17473] New: foreach on delegates incorrectly rejected | ||||
|---|---|---|---|---|
| ||||
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 } -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply