Error taking address of inherited pointer
Closed this issue · 0 comments
There is such a feature in C language that an operator of casting a pointer to another type causes the expression to rvalue, and we can no longer get the address of it. CPfront does not know about this. Therefore, the error is obtained at the C level.
In HostMenus:
TYPE
Item* = POINTER TO RECORD (StdDialog.Item)
PROCEDURE Close*;
VAR
item: StdDialog.Item;
BEGIN
SetShortcut(item);
We can't get the address here after casting. Need before. That is, it should be like this:
HostMenus_SetShortcut((HostMenus_Item*)&item);
A similar problem:
res := GtkU.gtk_signal_connect(item.mi, "activate", SYSTEM.ADR(MenuSelect),SYSTEM.VAL(INTEGER, item));
Here inside, the macro __VAL gets address from casted item. The same thing, if we get address of item with help of SYSTEM.ADR. We need to have some flag that "this entity is used to get the address", and do not cast it in this way.