fork download
  1. #include <iostream>
  2. #include <atomic>
  3.  
  4. struct A {
  5. std::atomic_bool b = false;
  6. };
  7.  
  8. int main()
  9. {
  10. A a;
  11. std::cout << a.b;
  12. return 0;
  13. }
  14.  
Compilation error #stdin compilation error #stdout 0s 16064KB
stdin
Standard input is empty
compilation info
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) { }
               ^~~~~~
stdout
Standard output is empty