Recent

Author Topic: Incompatible types error in constructor declaration  (Read 2004 times)

yogo1212

  • New Member
  • *
  • Posts: 22
Incompatible types error in constructor declaration
« on: October 29, 2013, 12:34:35 pm »
Hello,

i'm facing this error:
Code: [Select]
enginedevice.pas(55,57) Error: Incompatible types: got "Pointer" expected "AnsiString"

with this code:

Code: [Select]

{ TGamepadDevice }

TGamepadDevice = class(TGameDevice)
// This is for da loop 2 on linux
tmpevent: TJoystickEvent;

f: file of TJoystickEvent;
path: string;
ff_path: string;
procedure Prepare; override;
procedure DoTerminate; override;
procedure Fetch; override;
function GetNameOfDeviceEvent(id: word): string; override;
// This Line
constructor Create(inputname: string; device: String{Here}; ff_device: string = nil);
destructor Destroy; override;
end;                       

And i am puzzled.. Cant I declare constructors the way i want anymore with fpc 2.7.1?!

Some opinions before i file a bug report?

Or did i miss an incredibly important feature?

yogo1212

  • New Member
  • *
  • Posts: 22
Re: Incompatible types error in constructor declaration
« Reply #1 on: October 29, 2013, 12:46:30 pm »
Code: [Select]
ff_device: string = nil
I see it now....

Just wonder why it did compile with 2.6.2........

Sorry

Leledumbo

  • Hero Member
  • *****
  • Posts: 8819
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Incompatible types error in constructor declaration
« Reply #2 on: October 29, 2013, 05:04:16 pm »
Probably a bug in 2.6.2, ansistrings are internally pointers. A bug in the semantic checker might allow nil assignment to it.

 

TinyPortal © 2005-2018