From 5b5706cdeebffc859479021d20b9867a5789880a Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 13 Apr 2026 12:41:14 +0100 Subject: [PATCH] [spec/statement] Clarify `foreach` restrictions --- spec/statement.dd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/statement.dd b/spec/statement.dd index 3395e0413af4..332296466d8a 100644 --- a/spec/statement.dd +++ b/spec/statement.dd @@ -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`.) + $(IMPLEMENTATION_DEFINED If resizing or reassignment occurs and it is `@safe`.) + -------------- int[] a = [1, 2, 3]; auto fun = { a ~= 4; };