fork(1) download
  1. #include <string>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. class foo
  6. {
  7. public:
  8. foo();
  9. foo(long long) {}
  10. foo(const string &) {}
  11. operator long long()const { return 666; }
  12. explicit operator string()const { return "666"; }
  13. };
  14.  
  15. int main()
  16. {
  17. foo a;
  18.  
  19. string s = a;
  20. s = a;
  21.  
  22. long long b = a;
  23. b = a;
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:19:14: error: conversion from 'foo' to non-scalar type 'std::string {aka std::basic_string<char>}' requested
   string s = a;
              ^
stdout
Standard output is empty