fork(2) download
  1. class Module { };
  2.  
  3. struct Port {
  4. Module& owner;
  5. Port(Module& owner) : owner(owner) {}
  6. };
  7.  
  8. struct InPort : virtual Port { using Port::Port; };
  9. struct OutPort : virtual Port { using Port::Port; };
  10. struct InOutPort : InPort, OutPort { InOutPort(Module& m) : Port(m), InPort(m), OutPort(m) { } };
  11.  
  12. int main() {
  13. Module m;
  14. InOutPort p(m);
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In constructor 'InOutPort::InOutPort(Module&)':
prog.cpp:10:90: error: use of deleted function 'InPort::InPort(Module&)'
 struct InOutPort : InPort, OutPort { InOutPort(Module& m) : Port(m), InPort(m), OutPort(m) { } };
                                                                                          ^
prog.cpp:8:50: note: 'InPort::InPort(Module&)' is implicitly deleted because the default definition would be ill-formed:
 struct InPort    : virtual Port    { using Port::Port; };
                                                  ^
prog.cpp:8:50: error: no matching function for call to 'Port::Port()'
prog.cpp:8:50: note: candidates are:
prog.cpp:5:2: note: Port::Port(Module&)
  Port(Module& owner) : owner(owner) {}
  ^
prog.cpp:5:2: note:   candidate expects 1 argument, 0 provided
prog.cpp:3:8: note: constexpr Port::Port(const Port&)
 struct Port {
        ^
prog.cpp:3:8: note:   candidate expects 1 argument, 0 provided
prog.cpp:3:8: note: constexpr Port::Port(Port&&)
prog.cpp:3:8: note:   candidate expects 1 argument, 0 provided
prog.cpp:10:90: error: use of deleted function 'OutPort::OutPort(Module&)'
 struct InOutPort : InPort, OutPort { InOutPort(Module& m) : Port(m), InPort(m), OutPort(m) { } };
                                                                                          ^
prog.cpp:9:50: note: 'OutPort::OutPort(Module&)' is implicitly deleted because the default definition would be ill-formed:
 struct OutPort   : virtual Port    { using Port::Port; };
                                                  ^
prog.cpp:9:50: error: no matching function for call to 'Port::Port()'
prog.cpp:9:50: note: candidates are:
prog.cpp:5:2: note: Port::Port(Module&)
  Port(Module& owner) : owner(owner) {}
  ^
prog.cpp:5:2: note:   candidate expects 1 argument, 0 provided
prog.cpp:3:8: note: constexpr Port::Port(const Port&)
 struct Port {
        ^
prog.cpp:3:8: note:   candidate expects 1 argument, 0 provided
prog.cpp:3:8: note: constexpr Port::Port(Port&&)
prog.cpp:3:8: note:   candidate expects 1 argument, 0 provided
stdout
Standard output is empty