I’m dealing with a template, it’s very simple. This is the current structure:
//primary template
template<typename T>
const T bit_cast(const BitExpr* p);
//specialization
template<>
inline const BitBinExpr* bit_cast<BitBinExpr*>(const BitExpr* p) {
if (p->type == XOR || p->type == AND)
return static_cast<const BitBinExpr*>(p);
return nullptr;
}
// more specializations follow
But Visual Studio insists that this is not valid. However, when the parameter and return types were not const, this worked just fine. How can I convince VS to accept this code?
This seems to have cropped up a lot lately. These two types are not the same
and
Maybe this is what you are looking for