I'm working in a project with C++11 and I tried following code
#include <atomic>
struct A {
std::atomic_int idx = 1;
};
int main() {
return 0;
}
I get the compiler error
error: use of deleted function 'std::__atomic_base<_IntTp>::__atomic_base(const std::__atomic_base<_IntTp>&) [with _ITp = int]'
std::atomic_int idx = 1;
^
The same result is with C++14. When I switch to C++17 it works: wandbox
I checked cppreference for differences:
But there is no difference documented between C++14 and C++17. Why does it work with C++17 and not with C++14?