fpc/tests/webtbs/tw39845.pp
Jonas Maebe 3d6c53ee74 parentfpstruct: explicitly trash before initialising
It's an internal sym, but it contains user data. Together with the previous
commit resolves #39845
2022-07-26 22:36:13 +02:00

42 lines
509 B
ObjectPascal

{ %opt=-gt -Sc }
{$mode objfpc}
program Project1;
type TLLVMTest = class
str: ansistring;
pos: pchar;
procedure expect(c: char);
procedure test();
end;
var
l: TLLVMTest;
procedure TLLVMTest.expect(c: char);
procedure error;
begin
while (pos^ <> c) and (pos^ <> #0) do pos += 1;
end;
begin
if pos^ = c then
pos += 1
else
halt(1);
end;
procedure TLLVMTest.test();
begin
str := 'abc';
pos:=@str[1];
expect('a');
end;
begin
l := TLLVMTest.create;
l.test();
end.