View Issue Details

IDProjectCategoryView StatusLast Update
0016054FPCCompilerpublic2012-04-28 11:44
ReporterJiri Hajek Assigned ToSergei Gorelkin  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSWindows 
Product Version2.4.0 
Fixed in Version2.6.0 
Summary0016054: Failed compilation of late binding: Compiler only accepts integer as (late binding) arrayindex
DescriptionFPC generally speaking can properly compile most late binding code I tried while trying to convert MediaMonkey to FPC. However, there's a problem with string indexed property, which compiles and works flawlessly with Delphi, but not in FPC

See Steps To Reproduce for a sample code.

Error reported is: Incompatible types: got "ShortString" expected "LongInt"
Steps To Reproduce{$mode delphi}
var
  v: Variant;
  USBID: String;
  devlist: Variant;

begin
  devlist := v.ActiveDeviceList[ USBID];
end.
Tagscom
Fixed in Revision16864
FPCOldBugId0
FPCTarget
Attached Files

Activities

Jiri Hajek

2010-03-20 11:31

reporter   ~0035824

Note that I also tested the latest FPC nightly build in addition to 2.4.0 - the result is the same in both cases.

Jiri Hajek

2010-03-20 11:59

reporter   ~0035826

One more observation: The problem seems to be more general, not only related to strings. When the property parameter is Variant, the code is compiled by FPC, but it fails on execution (with various exceptions, depending on Variant content).

Marco van de Voort

2010-03-20 12:01

manager   ~0035827

Please test this in Delphi mode. Put {$mode delphi} on top of your source.

Jiri Hajek

2010-03-22 13:07

reporter   ~0035907

Yes, I also tested this using various compilation modes, including Delphi, but without any success.

Jiri Hajek

2010-03-30 11:05

reporter   ~0036285

I wonder, is there anything I could do about it? Any idea whom to discuss with, or where to look?

Marco van de Voort

2010-03-30 11:17

manager   ~0036286

Last edited: 2010-03-30 11:20

The problem seems to be the type of the array index. That is indeed a bug in the compiler, since Delphi accepts the same source.

It will require time of the compiler devels, and will probably be complicated.

There is nothing much you can do about, short of providing a patch yourself.

p.s. I'm sorry I misunderstood you earlier, you wrote it down clearly

Marco van de Voort

2010-09-25 14:21

manager   ~0041308

Still a problem.

Sergei Gorelkin

2012-04-28 11:43

developer   ~0059060

This was fixed in r16864 quite a while ago, but somehow I missed this report.

Since then, expressions 'variant_var.ident[indices]' are treated as an indexed property access, not as regular property followed by array subscript.

Issue History

Date Modified Username Field Change
2010-03-20 11:28 Jiri Hajek New Issue
2010-03-20 11:31 Jiri Hajek Note Added: 0035824
2010-03-20 11:59 Jiri Hajek Note Added: 0035826
2010-03-20 12:01 Marco van de Voort Note Added: 0035827
2010-03-20 15:09 Marco van de Voort Status new => feedback
2010-03-22 13:07 Jiri Hajek Note Added: 0035907
2010-03-30 11:05 Jiri Hajek Note Added: 0036285
2010-03-30 11:17 Marco van de Voort Note Added: 0036286
2010-03-30 11:17 Marco van de Voort Status feedback => confirmed
2010-03-30 11:19 Marco van de Voort FPCOldBugId => 0
2010-03-30 11:19 Marco van de Voort Summary Failed compilation of late binding => Failed compilation of late binding: Compiler only accepts integer as (late binding) arrayindex
2010-03-30 11:20 Marco van de Voort Steps to Reproduce Updated
2010-03-30 11:20 Marco van de Voort Note Edited: 0036286
2010-03-30 11:21 Marco van de Voort Tag Attached: com
2010-09-25 14:21 Marco van de Voort Note Added: 0041308
2012-04-28 11:43 Sergei Gorelkin Note Added: 0059060
2012-04-28 11:44 Sergei Gorelkin Fixed in Revision => 16864
2012-04-28 11:44 Sergei Gorelkin Status confirmed => resolved
2012-04-28 11:44 Sergei Gorelkin Fixed in Version => 2.6.0
2012-04-28 11:44 Sergei Gorelkin Resolution open => fixed
2012-04-28 11:44 Sergei Gorelkin Assigned To => Sergei Gorelkin