Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Language/Overloading    [ Add a report in this area ]  
Report #:  121641   Status: Closed
Overloaded version does not work
Project:  Delphi Build #:  XE2, ... XE5
Version:    19.0 Submitted By:   Laszlo Szabo
Report Type:  Feature Specification issue Date Reported:  1/9/2014 12:29:33 AM
Severity:    Infrequently encountered problem Last Updated: 4/15/2014 6:33:44 PM
Platform:    All versions Internal Tracking #:   46557
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE6
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
Overloading a procedure with an open array argument causes the open array argument not accepting simple type any longer.

Has been tested with XE5 update 2 Version 19.0.14356.6604,
same issue.
Steps to Reproduce:
Example:

procedure Foo(po_Arg1: TObject; var po_Arg2: array of word);

The above procedure call works with open array, static array and simple word variables as the 2nd argument.

var mn_data: word; <- works fine as the 2nd argument

overloading the Foo procedure like

procedure Foo(po_Arg1: TObject; var po_Arg2: array of word); overload;
procedure Foo(const pc_Arg1: string; var po_Arg2: array of word); overload;

After the overload, the 2nd argument will not accept single type variable.

var mn_data: word; <- is not accepted any longer as 'There is no overloaded version ...' happens

if mn_data is declared as array [0..1] of word for example it works.
Workarounds
None
Attachment
Sample.zip
Comments

Tomohiro Takahashi at 1/9/2014 5:57:26 PM -
Could you please attach sample project to reproduce/confirm your issue?

Laszlo Szabo at 1/10/2014 2:13:26 AM -
Attached sample.zip to demonstrate the issue.

TestOverload_Not_Ok.dpr:

If you compile it it is working now as mn_data is defined as array of word
To reproduce the issue please uncomment the mn_data: word;

and modify all writeln(mn_data[0]) line to writeln(mn_data)

Please note at compile you will get the "There is nor overloaded ..." message from the compiler.

The mn_data: word as Arg2 works wothout overloading.
After overloading the original Foo proc. Arg 2 is accepted only if it is an array of word alike.

Server Response from: ETNACODE01