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

          Issue ID: 16037
           Summary: Closure allocation despite scope variable for ternary
                    operator / CondExp
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: mathias.l...@sociomantic.com
                CC: pub...@dicebot.lv

The following allocates memory and thus does not compile:

```
void testXXX () @nogc
{
    Object o;
    scope bool delegate (Object) alwaysFalse = (Object y) { return false; };
    scope c1 = o !is null ? (Object y) { return o is y; } : alwaysFalse;
}
```

```
alloc.d(1): Error: function alloc.testXXX is @nogc yet allocates closures with
the GC
alloc.d(5):        alloc.testXXX.__lambda2 closes over variable o at alloc.d(3)
```

--

Reply via email to