dmd
dmd copied to clipboard
Fix Issue 21613 - DMD crash: copy ctor + templated rvalue ctor
Thanks for your pull request and interest in making D better, @RazvanN7! 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:andReturns:)
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
| Auto-close | Bugzilla | Severity | Description |
|---|---|---|---|
| ✓ | 21613 | critical | DMD crash: copy ctor + templated rvalue ctor |
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 "stable + dmd#13687"
@RazvanN7 going to rebase and finish this?
@9il it seems that this PR causes a breakage in mir/core. To me it looks like Algebraic ends up defining both a copy constructor and an rvalue constructor. Could you please update the code so that that does not happen anymore?
Edit: Offending code:
Variant!S a = S();
auto b = a;
Variant (which is an alias to Algebraic) defines a copy constructor because S defines a copy constructor. Algebraic also defines a templated constructor which is also tried auto b = a is semantically analyzed. This leads to the compiler seeing the possibility of this struct having both an rvalue constructor and a copy constructor.
I think we can get away by simply adding a constraint that excludes the constructor when the RHSTypes matches the instantiation types.
PR: https://github.com/libmir/mir-core/pull/81
@ibuclaw this should be ready to go once https://github.com/libmir/mir-core/pull/81 is in.
@ibuclaw this is ready to go.