Initialization list may not function properly.

Started by
4 comments, last by WitchLord 5 years, 11 months ago

This problem only occurs when `asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE` is enabled.


engine->SetEngineProperty(asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE, 1);

First of all, set as above.


void main()
{
  dictionary d2 = {{'a', dictionary = {{'aa', 1}, {'ab', 2}}}, 
                   {'b', dictionary = {{'ba', 1}, {'bb', 2}}}};
  
  auto d2a = cast<dictionary>(d2['a']);
  print("d2a.getSize:" + d2a.getSize() + "\n");
}

Next, when you execute the above, the result is as follows.


>asrun.exe script2.as
d2a.getSize:0

 

Advertisement

Thanks. I'll investigate this.

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

I've made changes in revision 2512 so that the compiler will now implicitly make the ref types handles in initialization lists when asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE is set. This solves the problem you identified.

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

Thanks!, However it seems that another problem has occurred.


  dictionary d1;
  d1.set('a', dictionary = {{'aa', 1}, {'ab', 2}});

Executing the above code will result in the following.


Assertion failed: tempVariables.GetLength() == 0, file ...\sdk\angelscript\source\as_compiler.cpp, line 1165

 

This wasn't caused by the previous change. Anyway, I've fixed this too in revision 2513.

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

This topic is closed to new replies.

Advertisement