Skip to content

Conversation

@ntrel
Copy link

@ntrel ntrel commented Dec 12, 2025

I'm trying to make assigning to a struct rvalue an error, because often the assignment is silently thrown away:
dlang/dmd#21717 (comment)

That breaks some buildkite projects, including this one - so it will probably be a deprecation/error in an edition. This PR avoids breaking this project.

Use opOpAssign directly instead, which is in the spec:

an instance method can still be called on an rvalue struct instance,
even if the method is not const

https://dlang.org/spec/struct.html#member-functions

Alternatively, we could declare an lvalue for the temporary.

Use `opOpAssign` directly instead, which is in the spec:

> an instance method can still be called on an rvalue struct instance,
even if the method is not const

https://dlang.org/spec/struct.html#member-functions
@ntrel
Copy link
Author

ntrel commented Dec 12, 2025

Test failure seems unrelated:

../source/mir/rc/ptr.d(279): Error: returning `createRCWithContext(context._get_value().s, move(context))` escapes a reference to parameter `context`
../source/mir/rc/ptr.d(279):        perhaps annotate the parameter with `return`
../source/mir/rc/ptr.d(425): Error: template instance `mir.rc.ptr.castTo!(S, C)` error instantiating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant