Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to disable post-increment/decrement semantics #19606

Open
dlangBugzillaToGithub opened this issue Aug 12, 2019 · 2 comments
Open

Impossible to disable post-increment/decrement semantics #19606

dlangBugzillaToGithub opened this issue Aug 12, 2019 · 2 comments

Comments

@dlangBugzillaToGithub
Copy link

Manu reported this on 2019-08-12T03:18:36Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=20123

Description

D implements post-increment/decrement with a lowered expression.
According to the docs; (auto t = val, ++val, t)

I'm implementing C++'s atomic<T> type, which implements `operator++` & `operator--`, but I realised that the lowering is not atomic, and I seem to have no way to implement the post-inc/dec operators explicitly such that I can make them atomic.

To properly implement this library, I need a way to implement the post-int/dec operators explicitly.
@dlangBugzillaToGithub
Copy link
Author

turkeyman commented on 2019-08-12T03:19:25Z

Or a way to @disable the post-inc/dec semantics explicitly, so that I can implement pre-inc/dec without opening the door for a race on the lowering.

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2021-03-24T05:42:32Z

@thewilsonator updated dlang/dmd pull request #12301 "Fix issue20123 by allowing opUnaryRight to disable post-[inc|dec]rement" fixing this issue:

- Fix issue 20123 by allowing opUnaryRight to disable post-[inc|dec]rement

https://github.com/dlang/dmd/pull/12301

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

No branches or pull requests

1 participant