> -Severity (Error)
> -ID(local): 1
> -Code: UNINIT.CTOR.MUST --> IPCAtomic()
> -Message: 'this->value' is not initialized in this constructor.
> -Details:
>
> 'this->value' is not initialized in this constructor.
>
> * CommunicationTypes.h:198: 'this->value' is used, but is
> uninitialized.
>
> * CommunicationTypes.h:198: List of instantiations (may be
> incomplete)
>
> * CommunicationTypes.h:198: <anonymous>::IPCAtomic< ,
> >::#constructor
>
> Current status 'Analyze'
这是我的代码,我也尝试了其他选项,但 KW 仍然产生相同的错误
template <typename T, typename SerializeAs = T>
class IPCAtomic : public IPCBundleIfc
{
typedef IPCAtomic<T, SerializeAs> MyType;
public:
T value;
IPCAtomic() : value(T())
{
}
IPCAtomic(T v) : value(v)
{
static_assert(!std::is_base_of<IPCBundleIfc, T>::value, "type parameter of this class can not derive from IPCBundleIfc");
}
virtual ~IPCAtomic() {}
operator T& ()
{
return value;
}
MyType& operator=(const T& v)
{
if (&v != &value)
{
value = v;
}
return *this;
}
bool operator==(const T& v) const
{
return value == v;
}
bool operator==(const MyType& v) const
{
return value == v.value;
}
你能提供任何解决方案吗?