View Issue Details

IDProjectCategoryView StatusLast Update
0026195FPCCompilerpublic2015-01-06 14:16
ReporterMaciej Izak Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version2.7.1 
Summary0026195: Missing error for wrong generic method implementation (constraints)
DescriptionNo error for such declaration:

------------------------------
{$mode delphi}
type
  TA<A,B> = class
    procedure Foo;
  end;

procedure TA<C,D>.Foo; // no error!
begin
end;
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0027206 resolvedSven Barth [Patch] Christmas gift by FreeSparta : Generics.Collections 
has duplicate 0030474 closedSven Barth Normal compilation in the declaration "TFoo<K, V>" with implementation "TFoo<TKey, TValue>" 

Activities

Maciej Izak

2014-05-20 08:08

reporter  

b007.lpr (144 bytes)

Derit Agustin

2014-05-20 10:29

reporter   ~0075133

use this :

{$mode delphi}
type
  TA<A,B> = class
    procedure Foo;
  end;

procedure TA<A,B>.Foo; // no error!
begin
end;

replace C,D with A,B because C,D is not declared

Maciej Izak

2014-05-20 10:53

reporter   ~0075140

The main problem is that the compiler don't raise any error for presented code. :)

Flávio Etrusco

2014-11-02 02:13

reporter   ~0078812

Should the compiler even allow the/any template part (i.e. "<A,B>") at all?

Sven Barth

2014-11-12 22:18

manager   ~0079120

In mode Delphi it's required, because there you can overload a generic with multiple types (e.g. TA<A> and TA<A,B> in the same unit), so you need to differentiate which generic it belongs to.

Regards,
Sven

Issue History

Date Modified Username Field Change
2014-05-20 08:08 Maciej Izak New Issue
2014-05-20 08:08 Maciej Izak File Added: b007.lpr
2014-05-20 10:29 Derit Agustin Note Added: 0075133
2014-05-20 10:53 Maciej Izak Note Added: 0075140
2014-05-22 07:38 Maciej Izak Tag Attached: generics
2014-11-02 02:13 Flávio Etrusco Note Added: 0078812
2014-11-12 22:18 Sven Barth Note Added: 0079120
2015-01-06 14:16 Sven Barth Relationship added related to 0027206
2016-08-19 15:19 Sven Barth Relationship added has duplicate 0030474