blob: 09a5e4350763c0031eca5fa08d161fa8c9dacb30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
{ Source provided for Free Pascal Bug Report 2899 }
{ Submitted by "Mattias Gaertner" on 2004-01-17 }
{ e-mail: mattias@freepascal.org }
program StringCallByRef;
{$ifdef fpc}{$mode objfpc}{$H+}{$endif}
uses
Classes, SysUtils;
procedure DoSomething(const AString: string);
procedure NestedProc(var Dummy: string);
begin
Dummy:=Dummy; // dummy statement, no change
end;
var
s: String;
begin
s:=copy(AString,5,11);
writeln('Before NestedProc: "',s,'"');
NestedProc(s);
writeln('After NestedProc: "',s,'"'); // s is now emtpy
if s<>'AStrangeBug' then
halt(1);
end;
begin
DoSomething('WhatAStrangeBug');
end.
|