point-to-point: Fix error "member access into incomplete type"
Fix the error "member access into incomplete type" in point-to-point/model/point-to-point-channel.h
:
src/core/model/ptr.h:636:14: error: member access into incomplete type 'ns3::PointToPointNetDevice' [clang-diagnostic-error]
m_ptr->Ref();
^
src/core/model/ptr.h:650:5: note: in instantiation of member function 'ns3::Ptr<ns3::PointToPointNetDevice>::Acquire' requested here
Acquire();
^
src/point-to-point/model/point-to-point-channel.h:202:15: note: in instantiation of member function 'ns3::Ptr<ns3::PointToPointNetDevice>::Ptr' requested here
m_src(nullptr),
^
src/point-to-point/model/point-to-point-channel.h:32:7: note: forward declaration of 'ns3::PointToPointNetDevice'
class PointToPointNetDevice;
^
Forward declarations can only be used when declaring pointers. However, this header was using the type when it was initializing the pointer with m_src(nullptr)
.
There are two solutions for this error. Either convert the forward declaration to a full include, or change the class so that the type is not used. I initially had opted for the former, but I think it's better to simply fix the class and keep the forward declaration.
Edited by Eduardo Almeida