@@ -3558,7 +3558,9 @@ $(H2 $(LNAME2 nogc-functions, No-GC Functions))
3558
3558
$(LI $(DDSUBLINK spec/expression, AssocArrayLiteral, constructing an associative array))
3559
3559
$(LI $(DDSUBLINK spec/expression, IndexExpression, indexing) an associative array
3560
3560
$(NOTE because it may throw $(D RangeError) if the specified key is not present))
3561
- $(LI $(DDSUBLINK spec/expression, NewExpression, allocating an object with `new`) on the heap)
3561
+ $(LI $(DDSUBLINK spec/expression, NewExpression, allocating an object with `new`) on the heap
3562
+ $(NOTE `new` declarations of $(D class types) in function scopes are compatible with
3563
+ $(D @nogc) if used for $(D scope) variables, as they result in allocations on the stack))
3562
3564
$(LI calling functions that are not `@nogc`, unless the call is
3563
3565
in a $(GLINK2 version, ConditionalStatement)
3564
3566
controlled by a $(GLINK2 version, DebugCondition))
@@ -3576,6 +3578,7 @@ $(H2 $(LNAME2 nogc-functions, No-GC Functions))
3576
3578
aa["abc"]; // (6) error, indexing may allocate and throws
3577
3579
3578
3580
auto p = new int; // (7) error, operator new allocates
3581
+ scope auto p = new GenericClass(); // (7) Ok
3579
3582
bar(); // (8) error, bar() may allocate
3580
3583
debug bar(); // (8) Ok
3581
3584
}
0 commit comments