GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

Libstdc++: Deprecate std::memory_order::consume

Deprecates `std::memory_order::consume` in libstdc++ as part of implementing P3475R2.

As part of implementing P3475R2, this commit deprecates std::memory_order::consume in libstdc++. The memory_order::consume is considered problematic and ineffective in practice. The commit adds deprecation attributes to memory_order::consume, memory_order_consume (in <stdatomic.h>), and kill_dependency. Testsuite adjustments are included to handle the new deprecation warnings.

In Details

This commit implements P3475R2, which deprecates memory_order::consume due to its complex and often misunderstood semantics. The interaction with <stdatomic.h> is notable because the paper didn't explicitly deprecate the C-style macro memory_order_consume. This commit opts to deprecate it for consistency.

For Context

In concurrent programming, memory ordering specifies how threads synchronize access to shared memory. std::memory_order::consume was intended to be an optimization for dependency ordering, but it has proven difficult to implement correctly and its benefits are unclear. This commit deprecates its use, meaning it will still be available but its use is discouraged, and it may be removed in a future version of the standard.

Filed Under: libstdc++atomicsmemory_orderdeprecationconcurrency