struct foo { operator bool() const { return true; } template<typename T> operator T() const = delete; }; int main() { foo f; if( f == true); if( f ); }
Standard input is empty
prog.cpp: In function ‘int main()’:
prog.cpp:17:12: error: use of deleted function ‘foo::operator T() const [with T = int]’
if( f == true);
^
prog.cpp:9:3: error: declared here
operator T() const = delete;
^
Standard output is empty