[Issue 16410] New: attribute inference inside templated classes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Aug 21 06:42:02 PDT 2016


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: nobody at puremagic.com
          Reporter: lodovico at giaretart.net
                CC: lodovico at giaretart.net

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- at nogc function check
}

--


More information about the Digitalmars-d-bugs mailing list