Skip to content

Commit e84d1e9

Browse files
committed
fix Issue 18568 - partially overlapping assignments have undefined behavior but are accepted in @safe code
1 parent fca481c commit e84d1e9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spec/expression.dd

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,17 @@ $(GNAME AssignExpression):
7777
)
7878

7979
$(UNDEFINED_BEHAVIOR
80+
If either operand is a reference type and one of the following:
8081
$(OL
81-
$(LI if the lvalue and rvalue have partially overlapping storage)
82-
$(LI if the lvalue and rvalue's storage overlaps exactly but the types are different)
82+
$(LI the operands have partially overlapping storage)
83+
$(LI the operands' storage overlaps exactly but the types are different)
84+
))
85+
86+
$(IMPLEMENTATION_DEFINED
87+
If neither operand is a reference type and one of the following:
88+
$(OL
89+
$(LI the operands have partially overlapping storage)
90+
$(LI the operands' storage overlaps exactly but the types are different)
8391
))
8492

8593
$(H3 $(LNAME2 simple_assignment_expressions, Simple Assignment Expression))

0 commit comments

Comments
 (0)