Advertisement

const not handled for object handles ?

Started by September 27, 2007 07:31 AM
1 comment, last by WitchLord 17 years ago
Hi, If i write the following code in angelscript :

class CTest
{
	int m_Int;

	void SetInt(int iInt)
	{
		m_Int = iInt;
	}
};

const CTest Test;
const CTest@ TestHandle = @Test;

TestHandle.SetInt(1);    // compiler incorrectly thinks this line is OK ???
Test.SetInt(1);          // compiler will correctly give an error on this line

Then the angelscript compiler gives correctly an error on "Test.SetInt(1);" stating that a matching const function cannot be found. It does not give an error however on the line "TestHandle.SetInt(1);" even though that one is also declared const and the handle references a const object. The same happens if functions declared in the C++ code return const handles to objects. Any non const functions called on those const object handles will not generate a compiler error. Is this a bug in the angelscript compiler or am I using handles wrongly ??? Thanks in advance. By The Way, Angelscript is Great !!
This looks like a bug in AngelScript. I'll give it a closer look as soon as I can. Thanks for the clear explanation.

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

Advertisement
I've fixed this in the latest WIP now. Thanks for letting me know about the problem.

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