Browse Source

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

git-svn-id: trunk@18916 -
pierre 14 years ago
parent
commit
0a3ac5a89d
1 changed files with 36 additions and 4 deletions
  1. 36 4
      tests/webtbs/tw20093.pp

+ 36 - 4
tests/webtbs/tw20093.pp

@@ -5,15 +5,47 @@
   both generate the same symbol name for the VMT
   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
 uses
   uvmt, uvmt_a;
   uvmt, uvmt_a;
 
 
+type
+  tclass = class(tobject)
+  end;
+  a_tclass = class(tobject)
+  end;
+
 var
 var
-  a1 : tclass;
-  a2 : a_tclass;
+  a1 : uvmt_a.tclass;
+  a2 : uvmt.a_tclass;
+  a3 : tclass;
+  a4 : a_tclass;
+  t : longint;
 begin
 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;
   a1.destroy;
   a2.destroy;
   a2.destroy;
+  a3.destroy;
+  a4.destroy;
 end.
 end.