Browse Source

+ new test which should fail but doesn't yet (it should not be possible to
use a char typecasted as a chararray with more than one element as an
lvalue)

git-svn-id: trunk@12708 -

Jonas Maebe 16 năm trước cách đây
mục cha
commit
b3aa2ab759
2 tập tin đã thay đổi với 21 bổ sung0 xóa
  1. 1 0
      .gitattributes
  2. 20 0
      tests/tbf/tb0215.pp

+ 1 - 0
.gitattributes

@@ -6662,6 +6662,7 @@ tests/tbf/tb0211.pp svneol=native#text/plain
 tests/tbf/tb0212.pp svneol=native#text/plain
 tests/tbf/tb0213.pp svneol=native#text/plain
 tests/tbf/tb0214.pp svneol=native#text/plain
+tests/tbf/tb0215.pp svneol=native#text/plain
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain

+ 20 - 0
tests/tbf/tb0215.pp

@@ -0,0 +1,20 @@
+{ %fail }
+
+{$r-}
+type
+  chararray = array[0..200] of char;
+var
+  p: pchar;
+  i: longint;
+begin
+  getmem(p,5);
+  p[0]:='a';
+  p[1]:='b';
+  p[2]:='c';
+  p[3]:='d';
+  p[4]:=#0;
+  i:=3;
+  chararray(p^)[i]:=#0;
+  writeln(p);
+  freemem(p);
+end.