#include <iostream> #include <atomic> struct A { std::atomic_bool b = false; }; int main() { A a; std::cout << a.b; return 0; }
Standard input is empty
prog.cpp:5:23: error: use of deleted function ‘std::atomic<bool>::atomic(const std::atomic<bool>&)’ std::atomic_bool b = false; ^~~~~ In file included from prog.cpp:2:0: /usr/include/c++/6/atomic:66:5: note: declared here atomic(const atomic&) = delete; ^~~~~~ /usr/include/c++/6/atomic:70:15: note: after user-defined conversion: constexpr std::atomic<bool>::atomic(bool) constexpr atomic(bool __i) noexcept : _M_base(__i) { } ^~~~~~
Standard output is empty