소스 검색

* allow absolute on array of const parameters, resolves #41292

florian 1 개월 전
부모
커밋
b6a686930a
2개의 변경된 파일15개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      compiler/pdecvar.pas
  2. 13 0
      tests/webtbs/tw41292.pp

+ 2 - 1
compiler/pdecvar.pas

@@ -1329,8 +1329,9 @@ implementation
                   { the same size since it refers to the field and not to   }
                   { the whole record -- which is why we use pt and not hp)  }
 
-                  { we can't take the size of an open array }
+                  { we can't take the size of an open array or an array of const }
                   if is_open_array(pt.resultdef) or
+                     is_array_of_const(pt.resultdef) or
                      (vs.vardef.size <> pt.resultdef.size) then
                     make_not_regable(pt,[ra_addr_regable]);
                 end

+ 13 - 0
tests/webtbs/tw41292.pp

@@ -0,0 +1,13 @@
+{$mode delphi}
+procedure proc(arg: array of const);
+var
+  p: array[0..999] of TVarRec absolute arg;
+begin
+  writeln(p[0].VInteger);
+  writeln(String(p[1].VPointer));
+  writeln(String(p[2].VPointer));
+end;
+
+begin
+  proc([100, 'foo', 'bar']);
+end.