Am 22.12.2021 um 19:16 schrieb Blaise--- via fpc-devel:
1) The attached metaclass_meth_to_procvar-1.patch fixes the internal
error reported for:
[ICE] Assigning class methods, accessed via a class reference type, to
incompatible procvars
-------8<-------
type C = class
class procedure NonStatic;
class procedure Static; static;
end;
class procedure C.NonStatic; begin end;
class procedure C.Static; begin end;
type CC = class of C;
var IncompatWNonStatic: procedure;
var IncompatWStatic: procedure of object;
begin
IncompatWNonStatic := CC.NonStatic; // ICE 200301042
IncompatWStatic := CC.Static // ICE 200301042
end.
-------8<-------
2) The attached metaclass_meth_to_procvar-2.patch fixes the invalid
codegen produced for:
[BadCG] Assigning class non-static methods, accessed via a class
reference type, to method pointers
-------8<-------
type C = class
class procedure Foo;
end;
class procedure C.Foo; begin end;
type CC = class of C;
var Z: procedure of object;
begin
Z := CC.Foo;
writeln( TMethod(Z).Code = @C.Foo ); // "FALSE"
writeln( TMethod(Z).Data = Pointer(C) ); // "FALSE"
end.
-------8<-------
Both accepted.
Regards,
Sven
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel