clang ++ complains about variable uninitialization:
template<typename TEnum> void func() {
TEnum enumVar;
if(something()) enumVar = someValue();
if(something()) doSomethingWith(enumVar);
}
Usually, to avoid this warning, an enumeration may have a value Unknown = -1or something similar, but, unfortunately, the enumeration type is passed by the user as here typename TEnum, so I don’t know if it contains "null value".
Is there any way to solve the problem? Or should I just ignore / suppress the warning?
source
share