Browse Source

+ add test for fixed #40077

Sven/Sarah Barth 2 years ago
parent
commit
d6d693696e
1 changed files with 23 additions and 0 deletions
  1. 23 0
      tests/webtbs/tw40077.pp

+ 23 - 0
tests/webtbs/tw40077.pp

@@ -0,0 +1,23 @@
+program tw40077;
+uses
+  Generics.Collections, Generics.Defaults;
+
+type
+  TRec = record
+    X: Int64;
+    Y: Int64;
+  end;
+  TDict = specialize TObjectDictionary<TRec, TObject>;
+
+var
+  Dict: TDict;
+  R: TRec;
+begin
+  Dict := TDict.Create([doOwnsValues]);
+  R.X := 1;
+  R.Y := 1;
+  if not Dict.ContainsKey(R) then // <---------- SIGSEGV here
+    Dict.Add(R, TObject.Create);
+  Dict.Free;
+end.
+