pascalabcnet/TestSuite/operator_implicit_T.pas

17 lines
283 B
ObjectPascal
Raw Permalink Normal View History

2019-05-29 23:48:30 +03:00
type
t1<T> = class
static function operator implicit(o: T): t1<T>; begin Assert(2=1); Result := nil; end;
end;
t2<T> = class(t1<T>) end;
2021-01-06 22:47:39 +03:00
var i: integer;
2019-05-29 23:48:30 +03:00
procedure p<T>(r: t1<T>);
begin
r := new t2<T>;
2021-01-06 22:47:39 +03:00
i := 1;
2019-05-29 23:48:30 +03:00
end;
begin
p(new t1<integer>);
2021-01-06 22:47:39 +03:00
assert(i = 1);
2019-05-29 23:48:30 +03:00
end.