fork download
  1. class CustomFoo {
  2.  
  3. virtual void do_stuff()=0;
  4. };
  5.  
  6. class Foo: CustomFoo {
  7.  
  8. void do_staff() {} final;
  9. };
  10.  
  11.  
  12. class FooWrapper {
  13.  
  14. vector<CustomFoo*> foos;
  15.  
  16. CustomFoo* operator->() {return foo[0];}
  17. };
  18.  
  19.  
  20. void main(){
  21.  
  22. FooWrapper wrapper;
  23. wrapper.foos.push_back(new Foo());
  24. wrapper->do_staff();
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:24: error: ‘final’ does not name a type
     void do_staff() {} final;
                        ^~~~~
prog.cpp:14:3: error: ‘vector’ does not name a type
   vector<CustomFoo*> foos;
   ^~~~~~
prog.cpp: In member function ‘CustomFoo* FooWrapper::operator->()’:
prog.cpp:16:35: error: ‘foo’ was not declared in this scope
   CustomFoo* operator->() {return foo[0];}
                                   ^~~
prog.cpp:16:35: note: suggested alternative: ‘Foo’
   CustomFoo* operator->() {return foo[0];}
                                   ^~~
                                   Foo
prog.cpp: At global scope:
prog.cpp:20:11: error: ‘::main’ must return ‘int’
 void main(){
           ^
prog.cpp: In function ‘int main()’:
prog.cpp:23:11: error: ‘class FooWrapper’ has no member named ‘foos’
   wrapper.foos.push_back(new Foo());
           ^~~~
prog.cpp:23:34: error: invalid new-expression of abstract class type ‘Foo’
   wrapper.foos.push_back(new Foo());
                                  ^
prog.cpp:6:7: note:   because the following virtual functions are pure within ‘Foo’:
 class Foo: CustomFoo {
       ^~~
prog.cpp:3:17: note: 	‘virtual void CustomFoo::do_stuff()’
    virtual void do_stuff()=0;
                 ^~~~~~~~
prog.cpp:24:10: error: ‘CustomFoo* FooWrapper::operator->()’ is private within this context
   wrapper->do_staff();
          ^~
prog.cpp:16:14: note: declared private here
   CustomFoo* operator->() {return foo[0];}
              ^~~~~~~~
prog.cpp:24:12: error: ‘class CustomFoo’ has no member named ‘do_staff’; did you mean ‘do_stuff’?
   wrapper->do_staff();
            ^~~~~~~~
            do_stuff
stdout
Standard output is empty