* Check that uvmt.a_int and uvmt_a.int variables have different location

git-svn-id: trunk@18916 -
This commit is contained in:
pierre 2011-08-30 15:52:59 +00:00
parent 09a50cc538
commit 0a3ac5a89d

View File

@ -5,15 +5,47 @@
both generate the same symbol name for the VMT
}
{ Use same name as unit to test also
possible confusion there }
{$mode objfpc}
program vmt_uvmt;
uses
uvmt, uvmt_a;
type
tclass = class(tobject)
end;
a_tclass = class(tobject)
end;
var
a1 : tclass;
a2 : a_tclass;
a1 : uvmt_a.tclass;
a2 : uvmt.a_tclass;
a3 : tclass;
a4 : a_tclass;
t : longint;
begin
a1 := tclass.create;
a2 := a_tclass.create;
t:=6;
inc(t);
uvmt.a_int:=t;
inc(t);
uvmt_a.int:=t;
if (uvmt_a.int - uvmt.a_int <> 1) then
begin
Writeln('Error in generated executable');
if (@int = @a_int) then
Writeln('Both variables are at same address');
halt(1);
end;
a1 := uvmt_a.tclass.create;
a2 := uvmt.a_tclass.create;
a3 := tclass.create;
a4 := a_tclass.create;
a1.destroy;
a2.destroy;
a3.destroy;
a4.destroy;
end.