View Issue Details

IDProjectCategoryView StatusLast Update
0034355FPCCompilerpublic2018-10-07 19:58
ReporterOndrej PokornyAssigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.3.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0034355: Array assignment is allowed yet it does nothing
DescriptionSee the test code in "Steps To Reproduce":

myArray := [aArray]; // both myArray and aArray are "array of string";

is allowed yet it does nothing. It should be either disallowed (=compile error) or it should copy aArray into myArray.
Steps To Reproduceprogram Project1;
{$mode objfpc}
procedure AssignArray(const aArray: array of string);
var
  myArray: array of string;
  S: string;
begin
  myArray := [aArray]; // << no compiler error, yet no assignment is executed
  Writeln('Length(myArray): ', Length(myArray));
  for S in myArray do
    Writeln(S);
end;
begin
  AssignArray(['abc', 'xyz']);
end.
TagsNo tags attached.
Fixed in Revision39882
FPCOldBugId
FPCTarget
Attached Files

Activities

delfion

2018-09-29 19:18

reporter   ~0111086

>both myArray and aArray are "array of string";
aArray is open array of AnsiString and myArray is dynamic array of AnsiString

Bart Broersma

2018-09-29 22:56

reporter   ~0111090

Last edited: 2018-09-29 22:57

View 2 revisions

> aArray is open array of AnsiString and myArray is dynamic array of AnsiString
[aArray] however is of the same type as myArray (notice the brackets).

Remove the brackets around aArray and the compiler will complain that one is an open array, the other a dynamic array.

Sven Barth

2018-09-30 15:46

manager   ~0111114

No, the type of [aArray] would be "array of (open) array of String".

Bart Broersma

2018-09-30 15:50

reporter   ~0111115

In that case the assignment should be illegal?

Sven Barth

2018-09-30 16:18

manager   ~0111117

Definitely.

Sven Barth

2018-10-07 14:27

manager   ~0111300

Please test and close if okay.

Ondrej Pokorny

2018-10-07 19:58

developer   ~0111314

Works well, thank you.

Issue History

Date Modified Username Field Change
2018-09-29 15:06 Ondrej Pokorny New Issue
2018-09-29 19:18 delfion Note Added: 0111086
2018-09-29 22:56 Bart Broersma Note Added: 0111090
2018-09-29 22:57 Bart Broersma Note Edited: 0111090 View Revisions
2018-09-30 15:46 Sven Barth Note Added: 0111114
2018-09-30 15:50 Bart Broersma Note Added: 0111115
2018-09-30 16:18 Sven Barth Assigned To => Sven Barth
2018-09-30 16:18 Sven Barth Status new => assigned
2018-09-30 16:18 Sven Barth Note Added: 0111117
2018-10-07 14:27 Sven Barth Fixed in Revision => 39882
2018-10-07 14:27 Sven Barth Note Added: 0111300
2018-10-07 14:27 Sven Barth Status assigned => resolved
2018-10-07 14:27 Sven Barth Fixed in Version => 3.3.1
2018-10-07 14:27 Sven Barth Resolution open => fixed
2018-10-07 19:58 Ondrej Pokorny Note Added: 0111314
2018-10-07 19:58 Ondrej Pokorny Status resolved => closed