Page MenuHomeFeedback Tracker

Inheriting from nested array type breaks array initialization
Assigned, NormalPublic

Description

When a custom class inherits from any nested array type (array<array<...>>), it breaks array initialization of other array types using array literals {}.
Note that the custom class doesn't have to be used, it just needs to exist.

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Modding
Steps To Reproduce

Example 1

class ArrayTest1: array<ref TStringArray>
{
	void Insert(int a, int b)
	{
	}
}

array<ref TStringArray> test = {};

TStringArray t = {"Test"};  // works
test.Insert(t);  // works

test.Insert({"Test"});  // compile error "array initialization of non-array type"

Example 2

class ArrayTest2: array<ref array<ref Param1<int>>>
{
	void Insert(int a, int b)
	{
	}
}

array<ref array<ref Param1<int>>> test = {};

array<ref Param1<int>> t = {new Param1<int>(0)};  // works
test.Insert(t);  // works

test.Insert({new Param1<int>(0)});  // compile error "array initialization of non-array type"

Event Timeline

lava76 created this task.Thu, Jul 31, 4:09 PM
lava76 updated the task description. (Show Details)Thu, Jul 31, 4:24 PM
lava76 edited Steps To Reproduce. (Show Details)
Geez changed the task status from New to Assigned.Fri, Aug 1, 11:35 AM