[core.atomic] atomicStore for alias this#3052
[core.atomic] atomicStore for alias this#3052thewilsonator wants to merge 4 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @thewilsonator! 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 referencesYour 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 locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + druntime#3052" |
|
I couldn't find the unittest after a quick search either, maybe it has been removed in the meantime. Anyway, a simple test that works for LDC but not DMD due to this would be: unittest
{
static struct S
{
int a;
alias a this;
}
import core.atomic;
S s;
atomicStore(s, 123);
} |
|
Awesome. Thanks! |
|
Tests added. |
b887388 to
623a95a
Compare
|
Do we really need this implicit conversion magic though ? The argument is passed by |
|
Git blames #2745 for the comment |
|
My refactor to simplify and untangle the implementation expects that all weird type wrangling is in the front-end wrappers. The "Implicit conversion" is for cases like The case in question with Should we add the constraint |
|
@Geod24 Since alias this is a language feature I don't see why we should not support it in this case. I wouldn't call it implicit conversion since the user explicitly defined the alias this. I agree that a better solution would be to stress out the condition in the template constraint so that in case of screw ups the compiler doesn't point to the innards of @thewilsonator Please update the function signature so that we can get this in. |
To what? |
Yes. |
|
Done.. |
|
Thanks! |
|
Hmm, this probably needs a rebase |
|
Nope, the error is legit. You probably need to switch the types of the |
|
Sorry, seems I missed this. Suggestion applied. Lets see if this works. |
|
This doesn't seem to be going anywhere. Also, pondering upon it, I agree with @Geod24 : "Do we really need this implicit conversion magic though ? The argument is passed by ref, implicit conversions are not expected.". Feel free to reopen if you still want to pursue this. |
@kinke the corresponding LDC commit mentions some unit tests, but I presume that they are in the main LDC repo, but I can't fin the correspond PR/commit. Do you know where they are and should they be moved to druntime?