fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class MBool
  5. {
  6. protected:
  7. bool mData;
  8. public:
  9. MBool() : mData(false) {}
  10. MBool(const MBool& rData) { mData = rData.mData; }
  11. };
  12.  
  13. void myFunc ( const MBool& rBool )
  14. {
  15. }
  16.  
  17. bool test()
  18. {
  19. myFunc( MBool() );
  20. myFunc( ( MBool() ) ); // <-- Error E2188 Expression syntax
  21. myFunc( MBool( false ) );
  22. myFunc( ( MBool( false ) ) );
  23. }
  24.  
  25. int main() {
  26. // your code goes here
  27. return 0;
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'bool test()':
prog.cpp:21:25: error: no matching function for call to 'MBool::MBool(bool)'
    myFunc( MBool( false ) );
                         ^
prog.cpp:21:25: note: candidates are:
prog.cpp:10:7: note: MBool::MBool(const MBool&)
       MBool(const MBool&  rData)      { mData = rData.mData; }
       ^
prog.cpp:10:7: note:   no known conversion for argument 1 from 'bool' to 'const MBool&'
prog.cpp:9:7: note: MBool::MBool()
       MBool() : mData(false)          {}
       ^
prog.cpp:9:7: note:   candidate expects 0 arguments, 1 provided
prog.cpp:22:27: error: no matching function for call to 'MBool::MBool(bool)'
    myFunc( ( MBool( false ) ) ); 
                           ^
prog.cpp:22:27: note: candidates are:
prog.cpp:10:7: note: MBool::MBool(const MBool&)
       MBool(const MBool&  rData)      { mData = rData.mData; }
       ^
prog.cpp:10:7: note:   no known conversion for argument 1 from 'bool' to 'const MBool&'
prog.cpp:9:7: note: MBool::MBool()
       MBool() : mData(false)          {}
       ^
prog.cpp:9:7: note:   candidate expects 0 arguments, 1 provided
stdout
Standard output is empty