Browse Source

* Class(classref) should not be allowed

peter 22 years ago
parent
commit
2e4fdfd4ec
1 changed files with 25 additions and 0 deletions
  1. 25 0
      tests/tbf/tb0151.pp

+ 25 - 0
tests/tbf/tb0151.pp

@@ -0,0 +1,25 @@
+{ %fail }
+
+{$ifdef fpc}{$mode objfpc}{$endif}
+
+type
+  TStream = class(TObject)
+    function Seek(offset:Int64):Int64;
+  end;
+
+  TSeek64 = function(offset:Int64):Int64 of object;
+
+function TStream.Seek(offset:Int64):Int64;
+begin
+end;
+
+var
+  s : TStream;
+  p : TSeek64;
+  c : TClass;
+begin
+  s:=TStream.Create;
+  c:=s.Classtype;
+  { This is not valid, @c should be used }
+  p:=@TStream(c).Seek;
+end.