[PATCH] enable -Winvalid-memory-order for C++ [PR99612]

Jonathan Wakely jwakely@redhat.com
Fri Jan 28 11:05:53 GMT 2022


On Fri, 28 Jan 2022 at 00:59, Martin Sebor wrote:
> In practice, I'd expect most calls to atomic functions to be made
> with constant memory models, and code like in the test case above
> to be uncommon, so I think the choice of warning at -O0 was
> the right one.

Some of us consider it a misfeature that the C++ functions use
function parameters for the memory model at all. They could have been
template arguments, so that only constants would be allowed:

atomic.fetch<memory_order_seq_cst>();



More information about the Gcc-patches mailing list