Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-02

Codepage + class helper raises "Error identifier idents no member ..."

12 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hello,

Consider the following code:

=== code ===

program project1;
{$mode objfpc}{$H+}
*//{$codepage utf8}*
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;
end.

=== /code ===

It compiles fine, but when you uncomment the line "//{$codepage utf8}", it raises:

'Error: identifier idents no member "Bar"'

If you confirm it as bug I can open a issue on bugtracker.

Silvio Clécio
Bart
to silvioprog
silvioprog wrote
It compiles fine, but when you uncomment the line "//{$codepage utf8}", it raises: 'Error: identifier idents no member "Bar"'

Same here.
fpc 3.0.0 win32.

Bart

silvioprog
to Bart
Bart wrote 10 lines
On 2/26/16, silvioprog wrote: > It compiles fine, but when you uncomment the line "//{$codepage utf8}", it > raises: > > 'Error: identifier idents no member "Bar"' Same here. fpc 3.0.0 win32.

Oops, I forgot to show my env. ^^'

Lazarus 1.7 rUnknown FPC 3.1.1 i386-win32-win32/win64

Silvio Clécio
Sven Barth
to silvioprog: Consider the following code: === code === program project1; {$mode objfpc}{$H+}…
"silvioprog" wrote 39 lines
Hello, Consider the following code: === code === program project1; {$mode objfpc}{$H+} //{$codepage utf8} 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; end. === /code === It compiles fine, but when you uncomment the line "//{$codepage utf8}",

it raises:

'Error: identifier idents no member "Bar"' If you confirm it as bug I can open a issue on bugtracker.

That definitely shouldn't be the case. Please report.

Regards,
Sven

Bart
to Bart
Bart wrote
It seems to do it for any codepage you insert.

And it disappears if you comment out the {H+} directive.

Bart

Bart
to Bart
Bart wrote
> It seems to do it for any codepage you insert. And it disappears if you comment out the {H+} directive.

It's the combination of
- codepage
- {$H+}
- var s: string = '';

Removing the initiaiation of the local string var (replace it with: "var s: string") makes compilation possible.

Bart

Bart
to silvioprog
silvioprog wrote
Now it is working like a charm. Thank you Bart and Sven! :-D

I merely reported it in Mantis.

(you can close the issue ^^ )

Done.

Bart