I have two base classes with using clauses
class MultiCmdQueueCallback {
using NetworkPacket = Networking::NetworkPacket;
....
}
class PlcMsgFactoryImplCallback {
using NetworkPacket = Networking::NetworkPacket;
....
}
I then declare a class
class PlcNetwork :
public RouterCallback,
public PlcMsgFactoryImplCallback,
public MultiCmdQueueCallback {
private:
void sendNetworkPacket(const NetworkPacket &pdu);
}
the compiler then flags an error reference to 'NetworkPacket' is ambiguous 'sendNetworkPacket(NetworkPacket &... '
Now both 'using clauses' resolve to the same underlying class Networking:NetworkPacket
and in fact if I replace the method declaration with:
void sendNetworkPacket(const Networking::NetworkPacket &pdu);
it compiles fine.
Why is the compiler treating each using clause as a distinct type even though they both point to the same underlying type. Is this mandated by the standard or do we have a compiler bug ?
Before looking at alias resulting type, (and accessibility)
we look at names
and indeed,
NetworkPacket
might be
MultiCmdQueueCallback::NetworkPacket
PlcMsgFactoryImplCallback::NetworkPacket
The fact they both point to Networking::NetworkPacket
is irrelevant.
We do first name resolution, which results in ambiguity.