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: [email protected]
Reporter: [email protected]
CC: [email protected]
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)
```
--