Jump to content
  • Advertisement
perost86

Object handle and constructor with array argument triggers assert

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

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

I'll have it fixed as soon as possible.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!