fork download
  1. #include <iostream>
  2.  
  3. class A {
  4.  
  5. public:
  6. A() : val(0) {};
  7. A(int v) : val(v) {};
  8.  
  9. private:
  10. int val;
  11. };
  12.  
  13. void foo (const A&){}
  14.  
  15. main() {
  16.  
  17. int number;
  18.  
  19. A a; /* GOOD, object of type A, created without arguments */
  20. A b(2); /* GOOD, object of type A, created with one argument */
  21. //A c();
  22. A(d); /* GOOD, object of type A again; no arguments */
  23. foo(A(number)); // No problem - creates a temporary
  24. }
Success #stdin #stdout 0s 2680KB
stdin
Standard input is empty
stdout
Standard output is empty