class Module { };
struct Port {
Module& owner;
Port(Module& owner) : owner(owner) {}
};
struct InPort : virtual Port { using Port::Port; };
struct OutPort : virtual Port { using Port::Port; };
struct InOutPort : InPort, OutPort { InOutPort(Module& m) : Port(m), InPort(m), OutPort(m) { } };
int main() {
Module m;
InOutPort p(m);
}
Y2xhc3MgTW9kdWxlIHsgfTsKCnN0cnVjdCBQb3J0IHsKCU1vZHVsZSYgb3duZXI7CglQb3J0KE1vZHVsZSYgb3duZXIpIDogb3duZXIob3duZXIpIHt9Cn07CgpzdHJ1Y3QgSW5Qb3J0ICAgIDogdmlydHVhbCBQb3J0ICAgIHsgdXNpbmcgUG9ydDo6UG9ydDsgfTsKc3RydWN0IE91dFBvcnQgICA6IHZpcnR1YWwgUG9ydCAgICB7IHVzaW5nIFBvcnQ6OlBvcnQ7IH07CnN0cnVjdCBJbk91dFBvcnQgOiBJblBvcnQsIE91dFBvcnQgeyBJbk91dFBvcnQoTW9kdWxlJiBtKSA6IFBvcnQobSksIEluUG9ydChtKSwgT3V0UG9ydChtKSB7IH0gfTsKCmludCBtYWluKCkgewoJTW9kdWxlIG07CglJbk91dFBvcnQgcChtKTsKfQ==
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