fpc/tests/webtbs/tw9026.pp
Jonas Maebe 3f701c96d4 * explicitly check for stringconstn next to stringdef in nadd, because
a stringconstn is often an arraydef. The result is that they again
    get the same typeconversion behaviour as string variables, which is
    important in case of overloaded operators (#9021/#9026)

git-svn-id: trunk@8268 -
2007-08-12 11:31:19 +00:00

29 lines
441 B
ObjectPascal

operator := (input:extended) output: string;
begin
str(round(input),output);
end;
operator + (const s: string; input:extended) output: string;
begin
str(round(input),output);
output:=s+output;
end;
procedure test(a:string);
begin
writeln(a);
if (a <> 'help1') then
halt(1);
end;
var
s: string;
begin
s:='help';
test('help'+1);
test(s+1);
test(s+1.2);
test(s+extended(1.2));
test(s+string(1.2));
end.