Help compiler deduce pure for moveEmplaceImpl#7670
Help compiler deduce pure for moveEmplaceImpl#7670JohanEngelen wants to merge 2 commits intodlang:masterfrom
pure for moveEmplaceImpl#7670Conversation
|
Thanks for your pull request and interest in making D better, @JohanEngelen! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
|
MoonlightSentinel
left a comment
There was a problem hiding this comment.
This puts no extra requirements on moveEmplaceImpl. moveEmplaceImpl already has to be pure because moveEmplaceImpl is called by moveEmplace which is explicitly marked pure.
But breaks move which doesn't have this requirement and calls user-defined opAssign/opPostMove
Fixes issue 21202
|
I'm shocked to see this stuff is still in |
|
Yes, but we couldn't remove this as there was one compile-time check that pulled in the world (about 2k of additional templates to druntime) |
|
Details: #6848 |
| } | ||
|
|
||
| // https://issues.dlang.org/show_bug.cgi?id=21202 | ||
| unittest |
There was a problem hiding this comment.
Can you please add attributes for the unittest block?
|
What stops the compiler from inferring the |
What if you put the function body in a |
|
@JohanEngelen Why is this necessary? The compiler should be able to deduce the purity of that function. |
|
|
(based on some of the comments, I am no longer convinced this is the correct fix, but the issue still stands) |
|
@JohanEngelen It is bad practice to force an attribute on a template (especially one that potentially calls user-defined functions). This is more likely a compiler bug. I'm going to close this PR and investigate this to get to the bottom of it. I will close this PR as this is most likely not fixing the root cause. Please reopen if you have anything else to add. |
|
@RazvanN7 Thanks for looking into fixing the compiler. This workaround is still needed at Weka. |
|
@JohanEngelen I have looked into it and it looks like a compiler bug: https://issues.dlang.org/show_bug.cgi?id=21850 . |
This fixes https://issues.dlang.org/show_bug.cgi?id=21202 .
This puts no extra requirements on
moveEmplaceImpl.moveEmplaceImplalready has to bepurebecausemoveEmplaceImplis called bymoveEmplacewhich is explicitly markedpure.