Skip to content

Draft: Example to debug multiple interface inheritance

Frank Winklmeier requested to merge fwinkl/Gaudi:interface_test into master

While migrating some of the ATLAS code to the auto-declaring "modern" interfaces, I am coming across a class hierarchy that I reproduced in this MR.

Compilation is failing with:

/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/IInterface.h: In instantiation of 'struct Gaudi::InterfaceId<MySvc, 1, 0>':
/builds/fwinkl/Gaudi/GaudiTestSuite/src/MultipleInheritance/Service.cpp:38:3:   required from here
/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/IInterface.h:193:11: error: lookup of 'ext_iids' in 'MySvc' is ambiguous
  193 |     using iids = typename Gaudi::interface_list_append<typename interface_type::ext_iids, InterfaceId>::type;
      |           ^~~~
/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/IInterface.h:26:9: note: candidates are: 'using IMySvc::ext_iids = using Gaudi::InterfaceId<IMySvc, 1, 0>::iids = using Gaudi::meta::id_<Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMySvc, 1, 0> > >::type = struct Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMySvc, 1, 0> >'
   26 |   using ext_iids = typename iid::iids
      |         ^~~~~~~~
/builds/fwinkl/Gaudi/GaudiTestSuite/src/MultipleInheritance/Service.cpp:28:3: note: in expansion of macro 'DeclareInterfaceID'
   28 |   DeclareInterfaceID(IMySvc, 1, 0);
      |   ^~~~~~~~~~~~~~~~~~
In file included from /builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/IInterface.h:356:
/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/extend_interfaces.h:26:9: note:                 'using extend_interfaces<IMySvc>::ext_iids = using Gaudi::meta::id_<Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMySvc, 1, 0> > >::type = struct Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMySvc, 1, 0> >'
   26 |   using ext_iids = typename Gaudi::interface_list_cat<typename Interfaces::ext_iids...>::type;
      |         ^~~~~~~~
/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/IInterface.h:26:9: note:                 'using IMyInterface::ext_iids = using Gaudi::InterfaceId<IMyInterface, 1, 0>::iids = using Gaudi::meta::id_<Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMyInterface, 1, 0> > >::type = struct Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMyInterface, 1, 0> >'
   26 |   using ext_iids = typename iid::iids
      |         ^~~~~~~~
/builds/fwinkl/Gaudi/GaudiTestSuite/src/MultipleInheritance/Service.cpp:20:3: note: in expansion of macro 'DeclareInterfaceID'
   20 |   DeclareInterfaceID(IMyInterface, 1, 0);
      |   ^~~~~~~~~~~~~~~~~~
/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/extend_interfaces.h:26:9: note:                 'using extend_interfaces<IMyInterface>::ext_iids = using Gaudi::meta::id_<Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMyInterface, 1, 0> > >::type = struct Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<IMyInterface, 1, 0> >'
   26 |   using ext_iids = typename Gaudi::interface_list_cat<typename Interfaces::ext_iids...>::type;
      |         ^~~~~~~~
/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/extend_interfaces.h:26:9: note:                 'using extend_interfaces<IService, IProperty, IStateful>::ext_iids = using Gaudi::meta::id_<Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<INamedInterface, 1, 0>, Gaudi::InterfaceId<IStateful, 1, 0>, Gaudi::InterfaceId<IService, 4, 0>, Gaudi::InterfaceId<IProperty, 3, 0> > >::type = struct Gaudi::interface_list<Gaudi::InterfaceId<IInterface, 0, 0>, Gaudi::InterfaceId<INamedInterface, 1, 0>, Gaudi::InterfaceId<IStateful, 1, 0>, Gaudi::InterfaceId<IService, 4, 0>, Gaudi::InterfaceId<IProperty, 3, 0> >'
/builds/fwinkl/Gaudi/GaudiKernel/include/GaudiKernel/IInterface.h:26:34: error: invalid combination of multiple type-specifiers
   26 |   using ext_iids = typename iid::iids
      |                                  ^~~~
/builds/fwinkl/Gaudi/GaudiTestSuite/src/MultipleInheritance/Service.cpp:38:3: note: in expansion of macro 'DeclareInterfaceID'
   38 |   DeclareInterfaceID(MySvc, 1, 0);
      |   ^~~~~~~~~~~~~~~~~~

@clemenci is there any way to get this working without resorting to hand-writing the queryInterface method?

Merge request reports

Loading