fork(1) download
  1. #ifdef UNICODE
  2. typedef std::wstring _tstring;
  3. #else
  4. typedef std::string _tstring;
  5. #endif
  6.  
  7. class MbRange
  8. {
  9. public:
  10. MbRange() {}
  11. MbRange(const _tstring& str) {...}
  12.  
  13. // I/O stream friend functions
  14. friend ostream& operator<<(ostream& o, const MbRange& r)
  15. { return o << r.first << '-' << r.last; }
  16.  
  17. // data members
  18. _tstring first, last;
  19. };
  20.  
  21. //gives error message:
  22. //warning C4717: 'operator<<' : recursive on all control paths, function will cause runtime stack overflow
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:13: error: 'string' in namespace 'std' does not name a type
prog.cpp:11:19: error: '_tstring' does not name a type
prog.cpp:11:29: error: ISO C++ forbids declaration of 'str' with no type
prog.cpp:14:12: error: 'ostream' does not name a type
prog.cpp:18:5: error: '_tstring' does not name a type
prog.cpp: In constructor 'MbRange::MbRange(const int&)':
prog.cpp:11:35: error: expected primary-expression before '...' token
prog.cpp:11:35: error: expected ';' before '...' token
stdout
Standard output is empty