Comment #0 by bearophile_hugs — 2014-04-25T11:10:53Z
This is borderline between bug report and enhancement request.
Perhaps this should compile:
void main() @nogc {
import std.range: dropOne;
auto a1 = [1, 2];
auto a2 = a1.dropOne;
auto s1 = "hello";
auto s2 = s1.dropOne;
}
DMD 2.066alpha gives:
test.d(4,17): Error: @nogc function 'D main' cannot call non-@nogc function 'std.range.dropOne!(int[]).dropOne'
test.d(6,17): Error: @nogc function 'D main' cannot call non-@nogc function 'std.range.dropOne!string.dropOne'
Comment #1 by justin — 2014-07-11T16:52:46Z
The array literal will trip in this case. This test code compiles with the latest git head (v2.066-devel-8bee69a):
unittest
{
void ensureNoGC() @nogc
{
int[] a1;
auto a2 = a1.dropOne;
auto s1 = "hello";
auto s2 = s1.dropOne;
}
}
Comment #2 by bearophile_hugs — 2014-07-11T17:11:09Z