Skip to content

结构体的构造中添加类似out List<string>的参数时,会在给此out参数赋值时报错 #757

@ZHOURUIH

Description

@ZHOURUIH

版本:2.1.0
unity:2020.3.40f1c1

public struct test : IDisposable
{
public List a;
public test(out List b)
{
a = new List();
b = a;
}
public void Dispose() { }
}

new test(out List s);
具体报错信息为数组越界,ILInterpreter.cs:1152行.mStack[dst->Value] = mStack[val->Value];
本地测试mStack的长度为4,dst->Value为6,val->Value为3,所以访问数组下标6时会越界.
如果将struct改为class则没有此问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions