79589660

Date: 2025-04-24 00:34:00
Score: 0.5
Natty:
Report link

Compound assignments on volatile have actually been un-deprecated for C++23.

History

You can find here the discussion that led to the de-deprecation:

https://www.reddit.com/r/cpp/comments/jswz3z/compound_assignment_to_volatile_must_be/

The corresponding paper:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2327r0.pdf

The tracking of said paper's state (now accepted/merged):

https://github.com/cplusplus/papers/issues/1023

And finally, the push by JF Bastien to revert the de-deprecation, which failed but led to all compound assignments on volatile being de-deprecated for consistency:

https://github.com/cplusplus/nbballot/issues/488

Silencing the warnings

Clang option -Wno-deprecated-volatile can be used to silence the warnings in the meanwhile, however, I believe it'll also silence warnings about other volatile uses that are still deprecated, such as volatile-qualified parameters and return types.

Removing most of the remaining deprecated uses of volatile is being discussed for C++26 and seems pretty close to adoption: https://github.com/cplusplus/papers/issues/1556

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Gabriel Morin