Skip to content

P0883R2 Fixing Atomic Initialization #336

@StephanTLavavej

Description

@StephanTLavavej

P0883R2 Fixing Atomic Initialization

As C++17/20 Features and Fixes in Visual Studio 2019 announced, Miya implemented the core functionality of this feature in VS 2019 16.0:

P0883 "Fixing atomic initialization", which changes std::atomic to value-initialize the contained T rather than default-initializing it, was implemented (also by Miya) when using Clang/LLVM with our standard library. This is currently disabled for C1XX as a workaround for a bug in constexpr processing.

STL/stl/inc/atomic

Lines 1446 to 1450 in 8f4c816

#ifdef __clang__ // TRANSITION, VSO-406237
constexpr atomic() noexcept(is_nothrow_default_constructible_v<_Ty>) : _Base() {}
#else // ^^^ no workaround / workaround vvv
atomic() = default;
#endif // TRANSITION, VSO-406237

Now that P0883 has been voted into the Standard, there are at least three more things to do:

  • C1XX fixed the constexpr initialization bug (Microsoft-internal VSO-406237), so we need to remove the workaround.
  • P0883 was updated to deprecate things. We need to implement those deprecations, and double-check that we've implemented everything that was voted in.
  • Feature-test macro as of WG21-N4842:
    #define __cpp_lib_atomic_value_initialization 201911L

Metadata

Metadata

Assignees

No one assigned

    Labels

    cxx20C++20 featurefixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions