Browse Source

* fix for Mantis #32108: ensure that types are registered once there is no more specialization is going on

git-svn-id: trunk@37341 -
svenbarth 7 years ago
parent
commit
a1c910d892
4 changed files with 50 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 4 0
      compiler/pdecl.pas
  3. 10 0
      tests/webtbs/tw32108.pp
  4. 34 0
      tests/webtbs/uw32108.pp

+ 2 - 0
.gitattributes

@@ -15781,6 +15781,7 @@ tests/webtbs/tw31945.pp svneol=native#text/pascal
 tests/webtbs/tw3197.pp svneol=native#text/plain
 tests/webtbs/tw3207.pp svneol=native#text/plain
 tests/webtbs/tw3210.pp svneol=native#text/plain
+tests/webtbs/tw32108.pp svneol=native#text/pascal
 tests/webtbs/tw32111.pp svneol=native#text/pascal
 tests/webtbs/tw32118.pp svneol=native#text/pascal
 tests/webtbs/tw3212.pp svneol=native#text/plain
@@ -16435,6 +16436,7 @@ tests/webtbs/uw3179a.pp svneol=native#text/plain
 tests/webtbs/uw3179b.pp svneol=native#text/plain
 tests/webtbs/uw3184a.pp svneol=native#text/plain
 tests/webtbs/uw3184b.pp svneol=native#text/plain
+tests/webtbs/uw32108.pp svneol=native#text/pascal
 tests/webtbs/uw3292a.pp svneol=native#text/plain
 tests/webtbs/uw3340.pp svneol=native#text/plain
 tests/webtbs/uw3353.pp svneol=native#text/plain

+ 4 - 0
compiler/pdecl.pas

@@ -743,6 +743,10 @@ implementation
                   of the defs in the def list of the module}
                 ttypesym(sym).typedef:=hdef;
               newtype.typedef:=hdef;
+              { ensure that the type is registered when no specialization is
+                currently done }
+              if current_scanner.replay_stack_depth=0 then
+                hdef.register_def;
               { KAZ: handle TGUID declaration in system unit }
               if (cs_compilesystem in current_settings.moduleswitches) and
                  assigned(hdef) and

+ 10 - 0
tests/webtbs/tw32108.pp

@@ -0,0 +1,10 @@
+program tw32108;
+
+uses uw32108;
+
+begin
+  if getTFooF <> 1 then
+    Halt(1);
+  Writeln('ok');
+end.
+

+ 34 - 0
tests/webtbs/uw32108.pp

@@ -0,0 +1,34 @@
+unit uw32108;
+
+{$mode delphi}
+
+interface
+
+function getTFooF: Integer;
+
+implementation
+
+type
+
+  { TFoo }
+
+  TFoo = class
+    class var f: integer;
+    class constructor Create;
+  end;
+
+{ TFoo }
+
+class constructor TFoo.Create;
+begin
+  f := 1;
+end;
+
+function getTFooF: Integer;
+begin
+  Result := TFoo.f;
+end;
+
+begin
+end.
+