Template instantiation & inheritance - fixed, but can I scrap the warning I get to do it?

John Graham johngavingraham@googlemail.com
Sat Feb 27 22:43:00 GMT 2010


Okay, I seem to have gone and answered my own question!

For some reason I couldn't do:


template class ost::TRTPSessionBase<ost::RTPBaseUDPIPv4Socket,
ost::RTPBaseUDPIPv4Socket, ost::AVPQueue>;


Because I'd get a few of the following back:


ccrtp/rtp.h: In member function 'ost::IPV4Host
ost::TRTPSessionBase<RTPDataChannel, RTCPChannel,
ServiceQueue>::getDataSender(ost::tpport_t*) const [with
RTPDataChannel = ost::RTPBaseUDPIPv4Socket, RTCPChannel =
ost::RTPBaseUDPIPv4Socket, ServiceQueue = ost::AVPQueue]':
rtpaudioport.cpp:24:   instantiated from here
ccrtp/rtp.h:205: error: no matching function for call to
'ost::RTPBaseUDPIPv4Socket::getSender(ost::tpport_t*&)'
ccrtp/channel.h:114: note: candidates are: ost::IPV4Host
ost::RTPBaseUDPIPv4Socket::getSender(ost::tpport_t&) const


But I can do:


inline template class ost::TRTPSessionBase<ost::RTPBaseUDPIPv4Socket,
ost::RTPBaseUDPIPv4Socket, ost::AVPQueue>;


And that seems to generate the necessary class information.

Still seems like a bit of a mystery that this has to be specifically
generated though... is there a reason for that?

Also, I have to turn off -pedantic-errors to compile that, as it's a
non-standard extension. Is there any way I can specify an
-fno-<something> option to turn this error off:

error: ISO C++ forbids the use of 'inline' on explicit instantiations


Thanks again,

John G



More information about the Gcc-help mailing list