Skip to content
Open
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
3 changes: 3 additions & 0 deletions spec/statement.dd
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@ $(H3 $(LNAME2 foreach_restrictions, Foreach Restrictions))
while `foreach` is iterating over the elements.
)

$(UNDEFINED_BEHAVIOR If one of those operations occurs and it is `@system`.)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 'it' refer to the operation or the enclosing function? The latter makes more sense to me, but the wording implies the former.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkorpel I think if the operation is allowed in @safe code, it should be implementation-defined iff it happens in @system code which doesn't do anything unsafe (or it does something unsafe that is unrelated to the operation).

$(IMPLEMENTATION_DEFINED If resizing or reassignment occurs and it is `@safe`.)

--------------
int[] a = [1, 2, 3];
auto fun = { a ~= 4; };
Expand Down
Loading