Is this a bug, or am I missing something?
Most probably because they are both "aliases" to the same type, rather than two new types.
[…] I thought the correct way is to raise an error just like setting it to TestString.I would expect that too.
Is this a bug, or am I missing something? […]
Tried Delphi and with @ operator, it will allow for compile.
[…]That’s inconsistent then. OkobaPatino’s program should compile without errors then, too. Nevertheless, FPC does not accept the address of the TestString procedure to be assigned to a procedural variable that only accepts TTestInt1 procedures. FPC’s error message is pretty specific about that:
Yes, because the @-operator simply returns a pointer. For example the following will compile without error as well:
[…]
This will only fail if {$T+} or {$TypedAddress On} is set which is not the case by default.
[…]That’s inconsistent then. OkobaPatino’s program should compile without errors then, too.
Yes, because the @-operator simply returns a pointer. For example the following will compile without error as well:
[…]
This will only fail if {$T+} or {$TypedAddress On} is set which is not the case by default.
I think the actual issue is that there is no operator definition
operator := (p: PInt2): PString;
/// As was code above var T: TTestInt1; begin T := @TestInt2; //Allows this Pointer(T):= @TestString; //Does not allow this << changes here. end;
I would like to know what campaign trip he is on.