@@ -759,6 +759,8 @@ uses
begin
newtype:=ctypesym.create(def.fullownerhierarchyname(false)+typName[def.typ]+'$'+def.unique_id_str,def);
newtype.owner:=def.owner;
+ { ensure that there's no warning }
+ newtype.refs:=1;
end;
if not assigned(newtype) then
internalerror(2021020904);
@@ -0,0 +1,36 @@
+{ %NORUN }
+
+program tw39675;
+{ "private type xyz never used" }
+{$warn 5071 error}
+{$mode delphi}
+{$ModeSwitch implicitfunctionspecialization}
+type
+ TWingFunc<T> = function(aArg: T): T of object;
+ TBird = class
+ public
+ function Fly<T>(aFunc: TWingFunc<T>; ArgB: T): T;
+ function Flap(s: string): string;
+ end;
+{ TBird }
+function TBird.Fly<T>(aFunc: TWingFunc<T>; ArgB: T): T;
+begin
+ Result:=aFunc(ArgB);
+end;
+function TBird.Flap(s: string): string;
+ Result:='Flap'+s;
+var
+ Bird: TBird;
+ Bird:=TBird.Create;
+ writeln(Bird.Fly(Bird.Flap,'Foo'));
+end.