blob: b46d58c1d4cbdb82a2e27807193c29ebeefedd9f (
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
|
{$mode objfpc}
{$h+}
{$inline on}
var
s: String;
function TestWinCPToUTF8(const s: string): string;
begin
if pointer(s)=pointer(result) then
halt(1);
Result := s; // Result is now invalid
SetCodePage(RawByteString(Result), CP_ACP, False);
end;
function Test: string; inline;
var
s: String;
begin
s := 'test';
result:=s+'a';
Result := TestWinCPToUTF8(Result);
end;
begin
s := Test;
end.
|