Sign in to follow this  

uint8 and uint16 constants cause compile-time assertion failure on type conversion to signed types.

This topic is 396 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sample code #1:

const uint8 foo = 0;
int bar = foo; 

Sample code #2:

const uint16 foo = 0;
void bar(int16) {}
void main() {
	bar(foo);
}

The assertion failure happens when function asCCompiler::ImplicitConversionConstant calls asCExprValue::GetConstantDW, which expects a type of exactly 4 bytes in size.

Edited by Sir Ementaler

Share this post


Link to post
Share on other sites

Thanks. These asserts were included to make sure the code properly supports big endian CPUs. Unfortunately some code was not properly endian agnostic.

 

Which version of AngelScript are you using? I have made some fixes in the latest WIP related to this already (though I will double check if the cases you report have indeed been fixed).

Share this post


Link to post
Share on other sites

This topic is 396 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this