Преглед изворни кода

* 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/tw7975.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/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 2 - 1
compiler/nutils.pas

@@ -628,7 +628,8 @@ implementation
               tempcreaten,
               tempdeleten,
               ordconstn,
-              pointerconstn:
+              pointerconstn,
+              niln:
                 exit;
               else
                 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.