Skip to content

Implement most RVO cases in glue layer#22526

Open
limepoutine wants to merge 1 commit intodlang:masterfrom
limepoutine:prvalue-part3
Open

Implement most RVO cases in glue layer#22526
limepoutine wants to merge 1 commit intodlang:masterfrom
limepoutine:prvalue-part3

Conversation

@limepoutine
Copy link
Contributor

@limepoutine limepoutine commented Feb 6, 2026

#22412, part 3

This PR enables direct construction in ConstructExp for any LHS and most RHS expressions, with two exceptions:

  • v = T(S(1)) doesn't emplace S(1) (a second PR is pending)
  • v = T(a: S(b: U(1)).a.b doesn't fold to v = U(1) (implementing this doesn't appear to be of much benefit)

Also fixes the bug that a = b = S(1) fails to call the copy constructor of S. Note the removed tests are fully covered by new ones.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @limepoutine! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#22526"

@limepoutine
Copy link
Contributor Author

Is it the test runners ran out of memory twice in a row, or is it I introduced a bug? Needs investigation anyway.

@limepoutine limepoutine marked this pull request as draft February 6, 2026 15:08
@limepoutine limepoutine marked this pull request as ready for review February 12, 2026 11:30
@limepoutine limepoutine changed the title Bring toElemRVO in line with canElideCopy Implement most RVO cases in glue layer Feb 13, 2026
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.

2 participants