Advertisement

Object handle and constructor with array argument triggers assert

Started by May 24, 2019 05:24 PM
3 comments, last by perost86 5 years, 5 months ago

This simple script triggers an assert during compilation of the script:


class TestClass
{
  TestClass(array<int> arr)
  {
    this.arr = arr;
  }

  private array<int> arr;
}

void main()
{
  TestClass @t = TestClass({});
}

The assert triggered when main is called is:


as_compiler.cpp:6474: asUINT asCCompiler::ImplicitConversion(asCExprContext *, const asCDataType &, asCScriptNode *, EImplicitConv, bool, bool):
Assertion `ctx->type.dataType.GetTokenType() != ttUnrecognizedToken || ctx->type.dataType.IsNullHandle() || ctx->IsAnonymousInitList()' failed.

The call stack shows that asCCompiler::ImplicitConversion is called from asCCompiler::CompileConstructCall at as_compiler.cpp:10935, and it's only called when the constructor has exactly one argument. Working around the issue by adding another argument to the constructor works just fine.

Thanks for the bug report with the sample to reproduce the problem.

I'll have it fixed as soon as possible.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've fixed this in revision 2588.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

9 minutes ago, WitchLord said:

I've fixed this in revision 2588.

Thanks! That does indeed fix the issue for me.

This topic is closed to new replies.

Advertisement