Codepage + {$H+} + ClassHelper + Initialized string variable gives: Error: identifier idents no member ...
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
Reported by Silvio Clécio in fpc-pascal mailinglist
(http://lists.freepascal.org/pipermail/fpc-pascal/2016-February/046998.html)
If your program has a {codepage xxx} and you have a classhelper and use {
H+} and you have an initiaize string variable (local or global) compiling will fail with: Error: identifier idents no member ...
Steps to reproduce:
{$apptype console}
{$ifdef fpc}
{$mode objfpc}
{$h+}
{$codepage utf8}
{$endif}
uses Classes;
type
TFoo = class helper for TStream
public
procedure Bar;
end;
procedure TFoo.Bar;
begin
end;
var
s: string = '';
m: TStream;
begin
m := TMemoryStream.Create;
try
m.Bar;
finally
m.Free;
end;
writeln(defaultsystemcodepage);
end.
C:\Users\Bart\LazarusProjecten\ConsoleProjecten>fpc test.pas
Free Pascal Compiler version 3.0.0 [2015/11/16] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling test.pas
test.pas(26,7) Error: identifier idents no member "Bar"
test.pas(32) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: C:\devel\fpc\3.0.0\bin\i386-Win32\ppc386.exe returned an error exitcode
Additional information:
This issue goes away if you do any of these things:
- remove {$H+}
- remove {$codepage xxx} (the issue does not depend on what codepage is specified)
- remove the initialization of variable "s"
Note: the issue also happens when "s" is a local varaiable in a procedure.
Mantis conversion info:
- Mantis ID: 29745
- OS: Windows
- OS Build: Win7
- Platform: i386
- Version: 3.0.0
- Fixed in version: 3.1.1
- Fixed in revision: 33214 (#27ab1c61)