struct Foo { int Bar; Foo& operator= (int Rhs) { this->Bar = Rhs; return *this; } }; const Foo F() { return Foo(); } int main() { F() = 42; }
Standard input is empty
prog.cpp: In function ‘int main()’:
prog.cpp:16:6: error: passing ‘const Foo’ as ‘this’ argument of ‘Foo& Foo::operator=(int)’ discards qualifiers [-fpermissive]
F() = 42;
^
Standard output is empty