浏览代码

* niln has a compelxity of 0 (so the inlining code doesn't try to take
its address) (mantis 8028)

git-svn-id: trunk@5735 -

Jonas Maebe 18 年之前
父节点
当前提交
5988e6d117
共有 3 个文件被更改,包括 31 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/nutils.pas
  3. 28 0
      tests/webtbs/tw8028.pp

+ 1 - 0
.gitattributes

@@ -7986,6 +7986,7 @@ tests/webtbs/tw7847.pp svneol=native#text/plain
 tests/webtbs/tw7963.pp svneol=native#text/plain
 tests/webtbs/tw7963.pp svneol=native#text/plain
 tests/webtbs/tw7975.pp svneol=native#text/plain
 tests/webtbs/tw7975.pp svneol=native#text/plain
 tests/webtbs/tw7975a.pp svneol=native#text/plain
 tests/webtbs/tw7975a.pp svneol=native#text/plain
+tests/webtbs/tw8028.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 2 - 1
compiler/nutils.pas

@@ -628,7 +628,8 @@ implementation
               tempcreaten,
               tempcreaten,
               tempdeleten,
               tempdeleten,
               ordconstn,
               ordconstn,
-              pointerconstn:
+              pointerconstn,
+              niln:
                 exit;
                 exit;
               else
               else
                 begin
                 begin

+ 28 - 0
tests/webtbs/tw8028.pp

@@ -0,0 +1,28 @@
+program test;
+
+{$mode objfpc}
+{$inline on}
+
+type
+  TTest = procedure of object;
+
+  TMyRecord = record
+    Test: TTest;
+  end;
+
+  TMyObject = class
+    procedure Test;
+  end;
+
+function TMyRecordMake(const Test: TTest): TMyRecord; inline;
+begin
+  Result.Test := Test;
+end;
+
+procedure TMyObject.Test;
+begin
+  TMyRecordMake(nil);
+end;
+
+begin
+end.