View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0016054 | FPC | Compiler | public | 2010-03-20 11:28 | 2012-04-28 11:44 |
Reporter | Jiri Hajek | Assigned To | Sergei Gorelkin | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Windows | OS | Windows | ||
Product Version | 2.4.0 | ||||
Fixed in Version | 2.6.0 | ||||
Summary | 0016054: Failed compilation of late binding: Compiler only accepts integer as (late binding) arrayindex | ||||
Description | FPC 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. | ||||
Tags | com | ||||
Fixed in Revision | 16864 | ||||
FPCOldBugId | 0 | ||||
FPCTarget | |||||
Attached Files |
|
|
Note that I also tested the latest FPC nightly build in addition to 2.4.0 - the result is the same in both cases. |
|
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). |
|
Please test this in Delphi mode. Put {$mode delphi} on top of your source. |
|
Yes, I also tested this using various compilation modes, including Delphi, but without any success. |
|
I wonder, is there anything I could do about it? Any idea whom to discuss with, or where to look? |
|
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 |
|
Still a problem. |
|
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. |
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 |