www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23112] New: code passes nogc, allocates anyway

https://issues.dlang.org/show_bug.cgi?id=23112

          Issue ID: 23112
           Summary: code passes  nogc, allocates anyway
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: su+dlangissues angel-island.zone

the following code allocates, bypassing  nogc and -vgc.

struct Forward(alias F) {
    auto opCall(Ts...)(Ts args) {
        return F(args);
    }
}

auto bar(T)(T a)  nogc nothrow  safe {
    auto f()
    {
        return a;
    }

    Forward!f val;
    return val;
}

--
May 16 2022