I've run into the following error:
class NormalClass
{
public:
constexpr NormalClass() : arr{}, debug_ptr((int*)arr)
{
//'reinterpret_cast' is not a constant expression
//cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
}
public:
char arr[5];
int* debug_ptr;
};
constinit NormalClass normal;
int main()
{
}
Originally this was in a template, with (T*) cast. Why is it that a cast like this isn't allowed in a constexpr?