Adriaan van Os wrote:
Jay Michael wrote:
gpc version 20070904, based on gcc-3.4.5 (mingw special) Given type INT16 = INTEGER attribute( size=16 ) ; type WORD16 = Cardinal attribute( size=16 ) ; var i16 : INT16 ; var w16 : WORD16 ; why does WORD16(I16) := W16 ; produce "error: invalid lvalue in assignment"?
A bug in the compiler. GPC is too picky when it comes to typecasts.
Do you have any idea why this case is rejected?
The compiler accepted
type winbool = boolean attribute( size = 32 ) ; var i : integer ; var wb : winbool ;
integer(wb) := 1024 ; integer(wb) := -1 ; integer(wb) := i ;
I thought BOOLEAN was an enumeration type. I thought an enumeration type was a second cousin to an unsigned integer. So I thought the only real difference in my case was that I was using 16-bit integers.
I was prepared for the compiler to accept the code and insist on generating range checks that I don't want. I'm just puzzled that it wouldn't even accept what looks to me to be just like examples I see posted of "variable type cast".