浏览代码

+ add test for fixed #40077

Sven/Sarah Barth 2 年之前
父节点
当前提交
41a208ee27
共有 1 个文件被更改,包括 23 次插入0 次删除
  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.
+