fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class test{
  5. public:
  6. test(int a/* = 1*/) : a_(a) {}
  7. int get() const { return a_; }
  8. private:
  9. int a_;
  10. };
  11.  
  12.  
  13. int main() {
  14. test t;
  15. return 0;
  16. }
  17.  
Compilation error #stdin compilation error #stdout 0.01s 5276KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:7: error: no matching function for call to ‘test::test()’
  test t;
       ^
prog.cpp:6:2: note: candidate: ‘test::test(int)’
  test(int a/* = 1*/) : a_(a) {}
  ^~~~
prog.cpp:6:2: note:   candidate expects 1 argument, 0 provided
prog.cpp:4:7: note: candidate: ‘constexpr test::test(const test&)’
 class test{
       ^~~~
prog.cpp:4:7: note:   candidate expects 1 argument, 0 provided
prog.cpp:4:7: note: candidate: ‘constexpr test::test(test&&)’
prog.cpp:4:7: note:   candidate expects 1 argument, 0 provided
stdout
Standard output is empty