www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16410] New: attribute inference inside templated classes


          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 puremagic.com
          Reporter: lodovico giaretart.net
                CC: lodovico 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- nogc function check

Aug 21 2016