4
#include <iostream>
#include <atomic>
using namespace std;    
typedef enum day{sun =0, mon, tue}day;    

int main() {
    atomic<day> a(sun);
    cout<<a<<endl;
    return 0;
}

The above code try to create a enum variable as atomic type. But i am getting the following error.

undefined reference to std::atomic<day>::operator day() const

Does atomic have no support for enum type? or any mistake in my syntax? I am using g++ compiler running on 32 bit ubuntu 12.0.4 machine. thank you.

Kumar
  • 616
  • 1
  • 18
  • 39

1 Answers1

1

I've compiled the same code with the online compiler that supports C++11 & C++14. I didn't get any issues.

atomic isn't available before C++11 standards.

For your reference: http://ideone.com/fork/Pe4gVt

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
MKR Harsha
  • 105
  • 9