View Issue Details

IDProjectCategoryView StatusLast Update
0025918FPCCompilerpublic2015-01-06 13:58
ReporterMaciej Izak Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version2.7.1 
Summary0025918: "Constraint override" in inner class (identifier idents no member)
DescriptionFPC in some way override constraint in inner class (Error: identifier idents no member "C"). More details in code.

probably related to:
http://bugs.freepascal.org/view.php?id=25917
---
{$APPTYPE CONSOLE}
{$MODE DELPHI}

type
  TX = class
  public const
    C = 1;
  end;

  TA<T1, T2> = class
  end;

  TB<T1, T2> = class
  private
    type
      T3 = record end;

      TC = class(TA<T1, TObject>) // TObject ovverride T2 from TB!
      public
        procedure Foo;
      end;

    procedure Foo;
  end;

procedure TB<T1, TX>.TC.Foo;
var
  L: TB<T1, T2>.T3;
begin
end;

procedure TB<T1, T2>.Foo;
begin
  WriteLn(T2.C); // Error: identifier idents no member "C"
end;

var
  x: TB<Pointer, TX>;
Tagsgenerics, partial specialization
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0027206 resolvedSven Barth [Patch] Christmas gift by FreeSparta : Generics.Collections 

Activities

Maciej Izak

2014-03-25 13:55

reporter  

plc02.lpr (581 bytes)

Ian Hickson

2014-03-27 02:51

reporter   ~0073998

Aren't you missing a "specialise" in the "class(TA<T1, TObject>)" bit? I don't understand "TObject ovverride T2 from TB!".

Maciej Izak

2014-03-27 16:25

reporter   ~0074018

Nope. "specialize" is not required in Delphi mode. In declaration "x: TB<Pointer, TX>;" T2 (from TB<T1, T2>) should be equal to TX, but in some way T2 (from TB<T1, T2>) is equal to TObject... Compiler bug. In some way inner class TC affects TB.

Issue History

Date Modified Username Field Change
2014-03-25 13:55 Maciej Izak New Issue
2014-03-25 13:55 Maciej Izak File Added: plc02.lpr
2014-03-26 13:18 Sven Barth Tag Attached: generics
2014-03-26 13:18 Sven Barth Tag Attached: partial specialization
2014-03-27 02:51 Ian Hickson Note Added: 0073998
2014-03-27 16:25 Maciej Izak Note Added: 0074018
2015-01-06 13:58 Sven Barth Relationship added related to 0027206