blob: e3bd6c611ec349a75aa90b3a563899dc76f5bba7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
{ %fail }
{ Source provided for Free Pascal Bug Report 2285 }
{ Submitted by "Sergey Kosarevsky" on 2002-12-25 }
{ e-mail: netsurfer@au.ru }
Type CLASS_CONSTRUCTOR=Function(Param:String):Boolean Of Object;
Type tObject=Object
Constructor Init(Param:String);
End;
var
a,b : longint;
Constructor tObject.Init(Param:String);
Begin
End;
Procedure CheckConstructor(C:CLASS_CONSTRUCTOR);
Begin
a:=Longint(Pointer(C));
WriteLn('a: ',a);
End;
Begin
{ This should fail, @tobject.init returns a pointer and
is not compatible with a methodpointer }
CheckConstructor(@tObject.Init);
b:=Longint(Pointer(@tObject.Init));
WriteLn('b: ',b);
if a<>b then
begin
writeln('Error!');
halt(1);
end;
End.
|