You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(sv): shallow copies of class-valued expressions, in any context and of null #1891
Shallow copies (new h, IEEE 1800-2023 8.12; #1810) are lowered only when the whole right-hand side of a handle assignment, declaration initializer or property initializer is new <operand>, and only when the operand is a handle variable, an element of an array of handles or a property. These valid forms are rejected:
Form
Example
Result
Operand that is a class-valued call, cast or conditional
C dst = new make_c();
"shallow copy of a value that is not a class handle"
Copy outside an assignment, where the context supplies the class
take(new h);, return new h;, x = c ? new a : b;
unsupported primary expression
null operand
dst = new null;
parse error, instead of the null-copy runtime error
Expected
Infer the operand's class from its expression type, lower ExprKind::Copy wherever a class-valued expression is bound (arguments, return values, conditional branches), and parse new null as a copy whose class comes from the destination, faulting at run time like other null copies.
Activity