Revert "Fixed an error where implicit pointer casts should've failed but didn't."

This reverts commit 68d3f474ce.

# Conflicts:
#	src/common/scripting/backend/codegen.cpp
This commit is contained in:
Rachael Alexanderson 2023-02-11 11:30:05 -05:00
parent 17800f2504
commit ea720605d4

View file

@ -274,14 +274,6 @@ bool AreCompatiblePointerTypes(PType *dest, PType *source, bool forcompare)
{
auto fromtype = source->toPointer();
auto totype = dest->toPointer();
// implicit pointer casts
if( fromtype->isClassPointer() && !totype->isClassPointer() ) totype->toClassPointer(fromtype); // just to make sure they're compatible pointer types
else if( !fromtype->isClassPointer() && totype->isClassPointer() ) fromtype->toClassPointer(totype); // just to make sure they're compatible pointer types
else if( fromtype->PointedType != totype->PointedType )
{
auto res = fromtype->PointedType->toClass(totype->PointedType);
if(!res || res != totype->PointedType) return false;
}
// null pointers can be assigned to everything, everything can be assigned to void pointers.
if (fromtype == nullptr || totype == TypeVoidPtr) return true;
// when comparing const-ness does not matter.