Support const-qualified service pointers (again)
The following discussion from !526 (merged) should be addressed:
-
@leggett started a discussion: (+1 comment) I just discovered that we have a lot of code in ATLAS that does this
Muon::RpcRDO_Decoder::initialize() { ... const IRPCcablingServerSvc* RpcCabGet = 0; StatusCode sc = service("RPCcablingServerSvc", RpcCabGet);
using a
reinterpret_cast<void*>
results in an compile time error:/bld2/build/v30r2/build/install/GAUDI/22.0.1/InstallArea/x86_64-centos7-gcc62-dbg/include/GaudiKernel/AlgTool.h:133:57: error: reinterpret_cast from type 'const IRPCcablingServerSvc**' to type 'void**' casts away qualifiers return service_i( name, createIf, T::interfaceID(), reinterpret_cast<void**>( &svc ) ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I don't think it's appropriate to remove the
const
from user code, as they're not using any non-const methods of the Service.