View Issue Details

IDProjectCategoryView StatusLast Update
0030503FPCRTLpublic2019-09-16 20:02
Reporterduxa174Assigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version3.1.1Product Build51308 
Target VersionFixed in Version 
Summary0030503: Problem compiling a code using TArray<TArray<Double>>
DescriptionHello,

When I try to compile the following code, I get the error:
Fatal: Syntax error, "EXCEPT" expected but "identifier CREATE" found

program Project;

{$MODE DELPHI}

uses
  Generics.Collections;

var
  Test :TArray<TArray<Double>>;
begin
    Test := TArray<TArray<Double>>.Create( // <-
      TArray<Double>.Create(0.0),
      TArray<Double>.Create(1.0)
    );
end.
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Relationships

related to 0035934 acknowledgedSven Barth Class variable declaration of nested generic classes type 
related to 0024283 new Generics syntax error, ">" expected but "<" found 

Activities

duxa174

2016-08-22 15:22

reporter  

project1.lpr (337 bytes)

Thaddy de Koning

2016-08-22 16:33

reporter   ~0094261

Last edited: 2016-08-22 16:46

View 3 revisions

Yes this does not compile.
It also doesn't compile in Delphi?.
And build number is 51308?
This is FPC. FPC's trunk is in the 34000's so about 20 years in the future that build number may show up ;)

Note there is a known issue that Tarray<T> is for now declared as TArray<T> = array of T. See the sources.

type
  TArray<T> = array of T; // for name TArray<T> conflict with TArray record implementation (bug 0026030)

Sven Barth

2016-08-22 20:07

manager   ~0094274

Declare the array type as a workaround:

=== code begin ===

type
  TArrayArrayDouble = TArray<TArray<Double>>;
var
  test: TArray<TArray<Double>>;
begin
  test := TArrayArrayDouble.Create(TArray<Double>.Create(1.0), TArray<Double>.Create(0.0));
end.

=== code end ===

Note: the Generics.Collections unit is not needed for TArray<> as that is declared in unit System.

duxa174

2016-08-23 07:44

reporter   ~0094281

"And build number is 51308?
This is FPC. FPC's trunk is in the 34000's so about 20 years in the future that build number may show up ;)"
Oh, I mixed up the build number of FPC and Lazarus. Sorry.

"It also doesn't compile in Delphi?"
The same code compiles and runs with XE8.

"Declare the array type as a workaround:"
Thanks.

silvioprog

2016-08-23 19:12

reporter   ~0094288

The duxa174's code is OK, it compiles fine in XE5, Seattle and Berlin too.

Thaddy de Koning

2016-08-24 09:27

reporter   ~0094296

@Sven
If Tarray<T> is declared in system is in that case the redelaration of TArray<T> on line 58 of genererics.collections.pas still correct?

Maciej Izak

2016-08-24 10:50

reporter   ~0094300

Last edited: 2016-08-24 10:51

View 2 revisions

@Thaddy
TArray<T> will be removed from Genererics.Collections. It was introduced before System.TArray<T> existed.

Issue History

Date Modified Username Field Change
2016-08-22 15:22 duxa174 New Issue
2016-08-22 15:22 duxa174 File Added: project1.lpr
2016-08-22 16:33 Thaddy de Koning Note Added: 0094261
2016-08-22 16:45 Thaddy de Koning Note Edited: 0094261 View Revisions
2016-08-22 16:46 Thaddy de Koning Note Edited: 0094261 View Revisions
2016-08-22 20:07 Sven Barth Note Added: 0094274
2016-08-22 20:07 Sven Barth Tag Attached: generics
2016-08-23 07:44 duxa174 Note Added: 0094281
2016-08-23 19:12 silvioprog Note Added: 0094288
2016-08-24 09:27 Thaddy de Koning Note Added: 0094296
2016-08-24 10:50 Maciej Izak Note Added: 0094300
2016-08-24 10:51 Maciej Izak Note Edited: 0094300 View Revisions
2019-08-09 10:25 Sven Barth Relationship added related to 0035934
2019-08-09 10:25 Sven Barth Relationship added related to 0024283
2019-08-09 10:26 Sven Barth Assigned To => Sven Barth
2019-08-09 10:26 Sven Barth Status new => acknowledged
2019-08-09 10:26 Sven Barth FPCTarget => -