[Issue 13967] New: More precise non- at nogc error messages
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jan 11 10:27:19 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13967
Issue ID: 13967
Summary: More precise non- at nogc error messages
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: diagnostic
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
>From the first error message it seems "joiner" is @nogc, but the second error
message shows that it's the iteration of r1 (calling its .front) non- at 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- at nogc
function 'std.algorithm.joiner!(MapResult!(__lambda2, Result)).joiner'
test.d(7,9): Error: @nogc function 'test.main.foo' cannot call non- at nogc
function 'test.main.foo.MapResult!(__lambda2, Result).MapResult.front'
I'd like error messages to better pinpoint where the non- at 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
--
More information about the Digitalmars-d-bugs
mailing list