Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P3309R3 constexpr atomic And atomic_ref #5146

Open
StephanTLavavej opened this issue Nov 25, 2024 · 3 comments
Open

P3309R3 constexpr atomic And atomic_ref #5146

StephanTLavavej opened this issue Nov 25, 2024 · 3 comments
Labels
cxx26 C++26 feature

Comments

@StephanTLavavej
Copy link
Member

StephanTLavavej commented Nov 25, 2024

WG21-P3309R3 constexpr atomic And atomic_ref

Feature-test macro (expected):

#define __cpp_lib_constexpr_atomic 202411L

Note: We're focused on implementing the remaining library-only features in C++23. Until that's done, we will NOT be accepting PRs for C++26 features.

@frederick-vs-ja
Copy link
Contributor

frederick-vs-ja commented Mar 17, 2025

It seems that compiler support is required to bypass non-trivial copy/move function templates that hijacks normal copy/move functions...

@StephanTLavavej
Copy link
Member Author

Can you explain a scenario where that's implied by the Standardese? My cat-sized brain isn't following.

@frederick-vs-ja
Copy link
Contributor

Can you explain a scenario where that's implied by the Standardese? My cat-sized brain isn't following.

#include <atomic>

struct S {
    S() = default;
    S(S&&) = default;
    S& operator=(const S&) = default;
    S& operator=(S&&) = default;

    S(const volatile S&) = delete;
    template<class = void>
    S(const S&) {}
};

int main() {
    std::atomic<S> a [[maybe_unused]] = S{};
}

Hmm, it seems to me that the constructor template in this example should be ignored (but libstdc++ and MSVC STL use it; Godbolt link).

For store etc., an assignment operator template might matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cxx26 C++26 feature
Projects
Status: Unimplemented
Development

No branches or pull requests

2 participants