Page MenuHomeFeedback Tracker

ScripVM unable to handle double templates + method override
Closed, ResolvedPublic

Description

If you attempt to compile the following code the engine crashes to death most of the time and if you are very lucky it prints the error message below the code thinking a function inside the base class does not exist. To reproduce this all aspects of the code example are important. The class that uses two templates, for the own class and for the base class, the fact that the base class has a function, that the inherited class attempts to override it, and that the whole class is tried to be instantiated. I tried around a bit, but could not find any clear workaround. This can only be fixed by debugging what is going on in the script VM. Thank you :)

class SomeType
{
}

class FirstClass<Class T>
{
	void SomeFnc(int someValue);
}

class SecondClass<Class T> : FirstClass<SomeType>
{
	T m_Value;
	
	void SecondClass(T argument)
	{
		m_Value = argument;
	}
	
	override void SomeFnc(int someValue)
	{
		PrintFormat("SomeFnc(%1)", someValue);
	}
}

void UseSecondClass()
{
	SecondClass<int> instance(1337);
}

SCRIPT (E): @"Scripts/Game/Core/Test.c,19": Function 'SomeFnc' is marked as override, but there is no function with this name in the base class
SCRIPT (E): @"Scripts/Game/Core/Test.c,19": ...while compiling template class 'SecondClass<int>'
SCRIPT (E): Can't compile "Game" script module!

Scripts/Game/Core/Test.c(19): Function 'SomeFnc' is marked as override, but there is no function with this name in the base class

Details

Severity
Crash
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Aug 27 2022, 1:51 PM
Geez changed the task status from New to Assigned.Aug 30 2022, 1:23 PM

Just checking in to say that currently with 0.9.7 this is still an issue. Crash to death.

Geez closed this task as Resolved.Apr 26 2023, 2:49 PM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello Arkensor.
The problem has been fixed internally and the fix will appear in one of the future updates.