D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20123 - Impossible to disable post-increment/decrement semantics
Summary: Impossible to disable post-increment/decrement semantics
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-08-12 03:18 UTC by Manu
Modified: 2024-12-13 19:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2019-08-12 03:18:36 UTC
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.
Comment 1 Manu 2019-08-12 03:19:25 UTC
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.
Comment 2 Dlang Bot 2021-03-24 05:42:32 UTC
@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
Comment 3 dlangBugzillaToGithub 2024-12-13 19:04:50 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19606

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB