From b31e6aef1652f3482620f53b2c6be93faa285868 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Fri, 8 May 2026 09:56:27 -0700 Subject: [PATCH] add note about VRP not applying to assignment operator exps --- spec/expression.dd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/expression.dd b/spec/expression.dd index 0a3030571f1a..5304b8b21571 100644 --- a/spec/expression.dd +++ b/spec/expression.dd @@ -448,6 +448,16 @@ $(H3 $(LNAME2 assignment_operator_expressions, Assignment Operator Expressions)) the binary operators. Still the left operand must be an lvalue. ) + $(P $(DDSUBLINK spec/type.html, vrp, Value Range Propagation) does not apply to assignment operator expressions:) + + --- + void f(ubyte b, int i) + { + b = b * i; // Error: cannot implicitly convert expression `cast(int)b * i` of type `int` to `ubyte` + b *= i; // no error + } + --- + $(H2 $(LNAME2 conditional_expressions, Conditional Expressions)) $(GRAMMAR