Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions spec/attribute.dd
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,24 @@ void main() @nogc
}
---

$(H3 $(LNAME2 scope-array-literal, Initializing a $(D scope) variable with an array literal))
$(P
When a `scope` dynamic array variable or parameter is initialized with an array literal,
the array may be allocated on the stack and permitted in a `@nogc` context.
)

$(SPEC_RUNNABLE_EXAMPLE_COMPILE
---------------
void fun(scope int[] x) @nogc;

void main() @nogc
{
fun([10, 20, 30]);
scope int[] x = [40, 50, 60];
}
---------------
)

$(H2 $(LNAME2 abstract, $(D abstract) Attribute))

$(P
Expand Down
2 changes: 1 addition & 1 deletion spec/garbage.dd
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ $(H2 D $(LNAME2 op_involving_gc, Operations That Involve the Garbage Collector))
$(LI $(GLINK2 expression, NewExpression))
$(LI Array appending)
$(LI Array concatenation)
$(LI Array literals (except when used to initialize static data))
$(LI Array literals (except when used to initialize static data or $(DDSUBLINK spec/attribute, scope, `scope`) variables))
$(LI Associative array literals)
$(LI Any insertion, removal, or lookups in an associative array)
$(LI Extracting keys or values from an associative array)
Expand Down