https://issues.dlang.org/show_bug.cgi?id=16410
Issue ID: 16410
Summary: attribute inference inside templated classes
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: major
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Example code:
class Bar(T)
{
T t;
// the following function is not inferred @nogc
// changing return type to auto solves the issue
ulong get()
{
return t.length;
}
}
@nogc void main()
{
import std.experimental.allocator;
import std.experimental.allocator.mallocator;
auto alloc = Mallocator.instance;
auto x = alloc.make!(Bar!string).check;
// error: @nogc main cannot call non-@nogc function check
}
--