Procházet zdrojové kódy

Fix for Mantis #24848.

ngenutil.pas, AddToStructsInit:
  * don't add class constructors/destructors to the init table if they belong to a generic type

+ test

git-svn-id: trunk@25234 -
svenbarth před 12 roky
rodič
revize
ff3bb9322a
3 změnil soubory, kde provedl 19 přidání a 0 odebrání
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/ngenutil.pas
  3. 17 0
      tests/webtbs/tw24848.pp

+ 1 - 0
.gitattributes

@@ -13474,6 +13474,7 @@ tests/webtbs/tw2473.pp svneol=native#text/plain
 tests/webtbs/tw2480.pp svneol=native#text/plain
 tests/webtbs/tw2480.pp svneol=native#text/plain
 tests/webtbs/tw2481.pp svneol=native#text/plain
 tests/webtbs/tw2481.pp svneol=native#text/plain
 tests/webtbs/tw2483.pp svneol=native#text/plain
 tests/webtbs/tw2483.pp svneol=native#text/plain
+tests/webtbs/tw24848.pp svneol=native#text/pascal
 tests/webtbs/tw2492.pp svneol=native#text/plain
 tests/webtbs/tw2492.pp svneol=native#text/plain
 tests/webtbs/tw2494.pp svneol=native#text/plain
 tests/webtbs/tw2494.pp svneol=native#text/plain
 tests/webtbs/tw2503.pp svneol=native#text/plain
 tests/webtbs/tw2503.pp svneol=native#text/plain

+ 1 - 0
compiler/ngenutil.pas

@@ -545,6 +545,7 @@ implementation
       StructList: TFPList absolute arg;
       StructList: TFPList absolute arg;
     begin
     begin
       if (tdef(p).typ in [objectdef,recorddef]) and
       if (tdef(p).typ in [objectdef,recorddef]) and
+         not (df_generic in tdef(p).defoptions) and
          ([oo_has_class_constructor,oo_has_class_destructor] * tabstractrecorddef(p).objectoptions <> []) then
          ([oo_has_class_constructor,oo_has_class_destructor] * tabstractrecorddef(p).objectoptions <> []) then
         StructList.Add(p);
         StructList.Add(p);
     end;
     end;

+ 17 - 0
tests/webtbs/tw24848.pp

@@ -0,0 +1,17 @@
+{ %NORUN }
+
+program project18;
+
+{$mode delphi}
+
+type
+  TFoo<T> = class
+    class constructor Create;
+  end;
+
+class constructor TFoo<T>.Create;
+begin
+end;
+
+begin
+end. // Error: Undefined symbol: P$PROJECT18$_$TFOO$1_$__$$_create