View Issue Details

IDProjectCategoryView StatusLast Update
0023799FPCRTLpublic2019-09-04 09:47
Reporteralex biasi Assigned ToMichael Van Canneyt  
Status resolvedResolutionfixed 
PlatformIntelOSWindows 7 
Product Version2.7.1 
Fixed in Version3.0.4 
Summary0023799: copy2symbdel from Unit Strutils generates compiler errror when using compiler directive $codepage
DescriptionThis compiler error will be generated:
"Got Shortstring, expected Ansistring"

When enabling Ansistring {$H+}, this compiler error is generated:
"Got Program.Ansistring, expected System.Ansistring"

->Same problem with this function from Strutils:

-> No Problem with other functions from Strutils, such as:
Leftstr, Rightstr, Copy2symb, Reversestring

I didn't test other functions.
Steps To Reproduce{$H+}
{$CODEPAGE cp850}
    a,b: string;
  b:='test string';
  a:=copy2symb(b,' ');
  a:=copy2symbdel(b,' ');
Fixed in Revision
Attached Files


alex biasi

2013-02-13 16:03

reporter   ~0065663

Actually the issue occurs on any call of a procedure/function which uses the VAR statement in the header if the procedure/function resides in a unit.
So seems to be a compiler issue.

Sven Barth

2013-02-13 18:45

manager   ~0065668

The problem is that using {$codepage ...} will create a local AnsiString type with that given codepage and that type can't be passed to a function that takes a "normal" AnsiString. I'm currently not sure whether this should be considered a compiler issue or "by design" and how we could solve this...


Bart Broersma

2019-02-13 00:17

reporter   ~0114066

Last edited: 2019-02-13 00:17

View 2 revisions

Current trunk will compile the test code (tested modes objfpc, delphi, tp, fpc).
And so does fpc 3.0.4

Michael Van Canneyt

2019-09-02 09:29

administrator   ~0117915

Seems that the compiler (3.0.4 and trunk) now handle this correctly, so closing.

Issue History

Date Modified Username Field Change
2013-01-31 18:16 alex biasi New Issue
2013-02-13 16:03 alex biasi Note Added: 0065663
2013-02-13 18:45 Sven Barth Note Added: 0065668
2013-02-14 10:06 Paul Ishenin Tag Attached: unicode
2019-02-13 00:17 Bart Broersma Note Added: 0114066
2019-02-13 00:17 Bart Broersma Note Edited: 0114066 View Revisions
2019-02-15 13:56 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-02-15 13:56 Michael Van Canneyt Status new => assigned
2019-09-02 09:29 Michael Van Canneyt Status assigned => resolved
2019-09-02 09:29 Michael Van Canneyt Resolution open => fixed
2019-09-02 09:29 Michael Van Canneyt Fixed in Version => 3.0.4
2019-09-02 09:29 Michael Van Canneyt FPCTarget => 3.0.4
2019-09-02 09:29 Michael Van Canneyt Note Added: 0117915