pascalabcnet/TestSuite/errors/err0400.pas
Ivan Bondarev 92c198c0a4 #2155
#2114
2021-01-08 19:56:42 +01:00

22 lines
593 B
ObjectPascal
Raw 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.

type
TBase = class end;
TErr<T> = class(TBase)
public static function operator implicit(o: T): TErr<T>;
begin
raise new System.InvalidOperationException;
end;
end;
procedure p0<T>(o: TErr<T>) := exit;
// обязательно вызывать p0 с шаблонным параметром p1
// если вызывать p0&<word> - выводит правильное сообщение об ошибке
procedure p1<T>(q: TBase) := p0&<T>(q); // это не должно компилироваться
begin
var q: TBase;
p1&<byte>(q);
end.