digitalmars.D.bugs - [Issue 13967] New: More precise non- nogc error messages
- via Digitalmars-d-bugs (33/34) Jan 11 2015 https://issues.dlang.org/show_bug.cgi?id=13967
https://issues.dlang.org/show_bug.cgi?id=13967 Issue ID: 13967 Summary: More precise non- nogc error messages Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: diagnostic Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.ccFrom the first error message it seems "joiner" is nogc, but the second errormessage shows that it's the iteration of r1 (calling its .front) non- nogc: void main() { import std.range: iota; import std.algorithm: map, joiner; static foo(in uint n) nogc { auto r1 = n.iota.map!(x => x.iota.map!(y => x)); auto r2 = r1.joiner; foreach (z; r1) {} } } test.d(6,21): Error: nogc function 'test.main.foo' cannot call non- nogc function 'std.algorithm.joiner!(MapResult!(__lambda2, Result)).joiner' test.d(7,9): Error: nogc function 'test.main.foo' cannot call non- nogc function 'test.main.foo.MapResult!(__lambda2, Result).MapResult.front' I'd like error messages to better pinpoint where the non- nogc actually is. Because with library functions like "joiner" you know they are designed to be nogc, but with user-written ranges it's harder to find where the problem is. See also Issue 12829 --
Jan 11 2015