digitalmars.D.bugs - [Issue 13805] New: Nested struct initialization error
- via Digitalmars-d-bugs (29/30) Dec 01 2014 https://issues.dlang.org/show_bug.cgi?id=13805
https://issues.dlang.org/show_bug.cgi?id=13805 Issue ID: 13805 Summary: Nested struct initialization error Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.ccFrom issue 13595. This looks like a compiler bug:void main() { import std.algorithm: map, groupBy; //[""].map!((string s) => s).groupBy!((x, y) => true); // OK [""].map!((s) => s).groupBy!((x, y) => true); // Error } dmd 2.067alpha gives: ...\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(4659): Error: field _prev must be initialized in constructor, because it is nested struct ...\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(4770): Error: template instance temp.main.groupBy!(__lambda2, cast(Flag)false, MapResult!(__lambda1, string[])) error instantiating temp.d(5): instantiated from here: groupBy!((x, y) => true, MapResult!(__lambda1, string[])) The error doesn't appear if you replace "(s)" with "(string s)". --
Dec 01 2014