mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 18:24:19 +02:00
* set addn resultdef when evaluating constant string concatenation
instead of letting the resulting stringconstn decide for itself (mantis #14174) git-svn-id: trunk@13419 -
This commit is contained in:
parent
5eb7a398e0
commit
63ce04fd00
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -9211,6 +9211,7 @@ tests/webtbs/tw1414.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw14143.pp svneol=native#text/plain
|
tests/webtbs/tw14143.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw14155.pp svneol=native#text/plain
|
tests/webtbs/tw14155.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1416.pp svneol=native#text/plain
|
tests/webtbs/tw1416.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw14174.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1430.pp svneol=native#text/plain
|
tests/webtbs/tw1430.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1433.pp svneol=native#text/plain
|
tests/webtbs/tw1433.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1445.pp svneol=native#text/plain
|
tests/webtbs/tw1445.pp svneol=native#text/plain
|
||||||
|
@ -666,7 +666,11 @@ implementation
|
|||||||
begin
|
begin
|
||||||
case nodetype of
|
case nodetype of
|
||||||
addn :
|
addn :
|
||||||
t:=cstringconstnode.createpchar(concatansistrings(s1,s2,l1,l2),l1+l2);
|
begin
|
||||||
|
t:=cstringconstnode.createpchar(concatansistrings(s1,s2,l1,l2),l1+l2);
|
||||||
|
typecheckpass(t);
|
||||||
|
tstringconstnode(t).changestringtype(resultdef);
|
||||||
|
end;
|
||||||
ltn :
|
ltn :
|
||||||
t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),booltype,true);
|
t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),booltype,true);
|
||||||
lten :
|
lten :
|
||||||
|
36
tests/webtbs/tw14174.pp
Normal file
36
tests/webtbs/tw14174.pp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
program Test;
|
||||||
|
|
||||||
|
type
|
||||||
|
TToken = (
|
||||||
|
tkNil,tkEOF,tkNumber,tkOpenBrace,tkCloseBrace,
|
||||||
|
tkPlus,tkMinus,tkTimes,tkSlash,tkCaret,tkSemiColon
|
||||||
|
);
|
||||||
|
|
||||||
|
function TokenToStr(const Token: TToken): String;
|
||||||
|
|
||||||
|
function Quote(const S: String): String;
|
||||||
|
inline; // comment out to avoid the internal error
|
||||||
|
begin
|
||||||
|
Quote:='"'+S+'"';
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
case Token of
|
||||||
|
tkNil : TokenToStr:=Quote('Unknown');
|
||||||
|
tkEOF : TokenToStr:=Quote('EOF');
|
||||||
|
tkNumber : TokenToStr:=Quote('Number');
|
||||||
|
tkOpenBrace : TokenToStr:=Quote('(');
|
||||||
|
tkCloseBrace: TokenToStr:=Quote(')');
|
||||||
|
tkPlus : TokenToStr:=Quote('+');
|
||||||
|
tkMinus : TokenToStr:=Quote('-');
|
||||||
|
tkTimes : TokenToStr:=Quote('*');
|
||||||
|
tkSlash : TokenToStr:=Quote('/');
|
||||||
|
tkCaret : TokenToStr:=Quote('^');
|
||||||
|
tkSemiColon : TokenToStr:=Quote(';');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if (TokenToStr(tkNil)<>'"Unknown"') then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user