fork download
  1. template<typename T>
  2. struct A {
  3. operator T() { return 0; }
  4. operator int() { return 1; }
  5.  
  6. void f() {
  7. operator T();
  8. }
  9. };
  10.  
  11. int main() {
  12. A<int> a;
  13. a.f();
  14. }
  15.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of 'A<int>':
prog.cpp:12:10:   instantiated from here
prog.cpp:4:3: error: 'A<T>::operator int() [with T = int]' cannot be overloaded
prog.cpp:3:3: error: with 'A<T>::operator T() [with T = int]'
stdout
Standard output is empty