fix(miscellaneous): fix misbehavior of assertions under some build types

This commit is contained in:
2022-04-26 23:04:50 +08:00
parent 099cba38f4
commit 897ee4f283
4 changed files with 24 additions and 19 deletions

View File

@ -31,12 +31,12 @@ FORCEINLINE void MemoryOrderCheck(EMemoryOrder Order, uint8 Require)
{
switch (Order)
{
case EMemoryOrder::Relaxed: checkf((Require) & 0x01, "Invalid memory order."); break;
case EMemoryOrder::Consume: checkf((Require) & 0x02, "Invalid memory order."); break;
case EMemoryOrder::Acquire: checkf((Require) & 0x04, "Invalid memory order."); break;
case EMemoryOrder::Release: checkf((Require) & 0x08, "Invalid memory order."); break;
case EMemoryOrder::AcquireRelease: checkf((Require) & 0x10, "Invalid memory order."); break;
case EMemoryOrder::SequentiallyConsistent: checkf((Require) & 0x20, "Invalid memory order."); break;
case EMemoryOrder::Relaxed: checkf((Require) & 0x01, TEXT("Invalid memory order.")); break;
case EMemoryOrder::Consume: checkf((Require) & 0x02, TEXT("Invalid memory order.")); break;
case EMemoryOrder::Acquire: checkf((Require) & 0x04, TEXT("Invalid memory order.")); break;
case EMemoryOrder::Release: checkf((Require) & 0x08, TEXT("Invalid memory order.")); break;
case EMemoryOrder::AcquireRelease: checkf((Require) & 0x10, TEXT("Invalid memory order.")); break;
case EMemoryOrder::SequentiallyConsistent: checkf((Require) & 0x20, TEXT("Invalid memory order.")); break;
default: check_no_entry();
}
}

View File

@ -359,7 +359,7 @@ struct TVariant
constexpr auto Visit(F&& Func) &
{
using ReturnType = typename TCommonType<typename TInvokeResult<F, Types>::Type...>::Type;
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return ReturnType(NAMESPACE_PRIVATE::TVariantVisitHelper<ReturnType, F, Types...>::VisitLValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}
@ -367,7 +367,7 @@ struct TVariant
constexpr auto Visit(F&& Func) &&
{
using ReturnType = typename TCommonType<typename TInvokeResult<F, Types>::Type...>::Type;
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return ReturnType(NAMESPACE_PRIVATE::TVariantVisitHelper<ReturnType, F, Types...>::VisitRValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}
@ -375,7 +375,7 @@ struct TVariant
constexpr auto Visit(F&& Func) const&
{
using ReturnType = typename TCommonType<typename TInvokeResult<F, Types>::Type...>::Type;
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return ReturnType(NAMESPACE_PRIVATE::TVariantVisitHelper<ReturnType, F, Types...>::VisitConstLValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}
@ -383,35 +383,35 @@ struct TVariant
constexpr auto Visit(F&& Func) const&&
{
using ReturnType = typename TCommonType<typename TInvokeResult<F, Types>::Type...>::Type;
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return ReturnType(NAMESPACE_PRIVATE::TVariantVisitHelper<ReturnType, F, Types...>::VisitConstRValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value)
constexpr R Visit(F&& Func) &
{
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return R(NAMESPACE_PRIVATE::TVariantVisitHelper<R, F, Types...>::VisitLValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value)
constexpr R Visit(F&& Func) &&
{
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return R(NAMESPACE_PRIVATE::TVariantVisitHelper<R, F, Types...>::VisitRValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value)
constexpr R Visit(F&& Func) const&
{
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return R(NAMESPACE_PRIVATE::TVariantVisitHelper<R, F, Types...>::VisitConstLValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value)
constexpr R Visit(F&& Func) const&&
{
checkf(IsValid(), "It is an error to call Visit() on an wrong TVariant. Please either check IsValid().");
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
return R(NAMESPACE_PRIVATE::TVariantVisitHelper<R, F, Types...>::VisitConstRValueFuncs[GetIndex()](Forward<F>(Func), &Value));
}