pascalabcnet/TestSuite/delegates25.pas
Ivan Bondarev 08c5c765b7 #3080
2024-04-14 14:14:46 +02:00

23 lines
327 B
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var i: integer;
procedure p0(p: byte->());
begin
p(1);
Inc(i);
end;
type
t1 = class
static procedure p1<T>(o: T) := exit;
procedure p2<T>(o: T) := exit;
end;
begin
// OK
p0(t1.p1&<byte>);
p0(t1.Create.p2&<byte>);
// А эти 2 падают
p0(t1.p1);
p0(t1.Create.p2);
assert(i = 4);
end.