Просмотр исходного кода

compiler: change Addr function to return untyped pointer by Blaise Thorn (issue #0018512), change/add tests

git-svn-id: trunk@16777 -
paul 14 лет назад
Родитель
Сommit
731291aee0
4 измененных файлов с 13 добавлено и 3 удалено
  1. 1 0
      .gitattributes
  2. 0 2
      compiler/pexpr.pas
  3. 2 1
      tests/webtbs/tw0882.pp
  4. 10 0
      tests/webtbs/tw18512.pp

+ 1 - 0
.gitattributes

@@ -10954,6 +10954,7 @@ tests/webtbs/tw18334.pp svneol=native#text/plain
 tests/webtbs/tw18443.pp svneol=native#text/pascal
 tests/webtbs/tw1850.pp svneol=native#text/plain
 tests/webtbs/tw1851.pp svneol=native#text/plain
+tests/webtbs/tw18512.pp svneol=native#text/pascal
 tests/webtbs/tw1856.pp svneol=native#text/plain
 tests/webtbs/tw1862.pp svneol=native#text/plain
 tests/webtbs/tw1863.pp svneol=native#text/plain

+ 0 - 2
compiler/pexpr.pas

@@ -535,8 +535,6 @@ implementation
               in_args:=true;
               p1:=comp_expr(true,false);
               p1:=caddrnode.create(p1);
-              if cs_typed_addresses in current_settings.localswitches then
-                include(p1.flags,nf_typedaddr);
               consume(_RKLAMMER);
               statement_syssym:=p1;
             end;

+ 2 - 1
tests/webtbs/tw0882.pp

@@ -18,7 +18,8 @@ BEGIN
         bb0^[0] := 1;
         bb0^[1] := 2;
        {$T+}
-        bw:=word(Addr(bb0^[mr.i1])^);
+        // Addr return untyped pointer, @ typed
+        bw:=word((@bb0^[mr.i1])^);
         if bw <> 1 then
           halt(1);
        {$T-}

+ 10 - 0
tests/webtbs/tw18512.pp

@@ -0,0 +1,10 @@
+{ %norun }
+program tw18152;
+{$TypedAddress on}
+var
+    p: ^integer;
+    c: char;
+begin
+    // test that addr return untyped pointer inspite of $TypedAddress directive
+    p := addr(c)
+end.