Steps to Reproduce
Given the following header:
`#pragma once
include “Containers/Array.h”
include “UObject/Object.h”
include “StaticDuplicateObjectTests.generated.h”
UCLASS()
class UBaseClass
: public UObject
{
GENERATED_BODY()
public:
UPROPERTY()
int32 A;
};
UCLASS()
class UDerivedClass
: public UBaseClass
{
GENERATED_BODY()
public:
UPROPERTY()
TArray< int32 > DerivedArray;
};`And this test:
`#include “StaticDuplicateObjectTests.h”
include “CQTest.h”
include UE_INLINE_GENERATED_CPP_BY_NAME(StaticDuplicateObjectTests)
TEST_CLASS(StaticDuplicateObjectTests, GenerateTestDirectory)
{
TEST_METHOD(GIVEN_SourceIsBaseOfDestination_WHEN_StaticDuplicateObjectCalled_THEN_Crash)
{
auto* Source = NewObject< UBaseClass >();
Source->A = -1;
auto* Copy = StaticDuplicateObject(Source, Source->GetOuter(), NAME_None, RF_AllFlags, UDerivedClass::StaticClass());
}
};`You will crash.