struct T {
int m_x;
T(int x) : m_x(x) {}
operator T() {
return T(0);
}
};
int main() {
volatile T v(2);
T nv(1);
nv = v; // nv.m_x = 0
}
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:14:10: error: no match for ‘operator=’ in ‘nv = v’ prog.cpp:14:10: note: candidates are: prog.cpp:1:8: note: T& T::operator=(const T&) prog.cpp:1:8: note: no known conversion for argument 1 from ‘volatile T’ to ‘const T&’ prog.cpp:1:8: note: T& T::operator=(T&&) prog.cpp:1:8: note: no known conversion for argument 1 from ‘volatile T’ to ‘T&&’
Standard output is empty