Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,259
    • Issues 1,259
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 47
    • Merge requests 47
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • FPC
  • FPC
  • FPC SourceFPC Source
  • Issues
  • #24073
Closed
Open
Created Mar 18, 2013 by FPC Admin account@fpc_adminOwner

Wrong behavior of generic "record parameter"

Original Reporter info from Mantis: hnb
  • Reporter name: Maciej Izak

Description:

Check out attached code:

program project4;

{$mode delphi}

type
  TA<T: record> = record
  end;

  TUnamanagedRec = record
    x: integer;
  end;

  TManagedRec = record
    s: string;
  end;

var
  a: TA<TUnamanagedRec>; // should pass and it is ok
  b: TA<TManagedRec>;  // should pass and it is ok
  d: TA<Single>;  // should pass but it's not ok in FPC! Error: Record type expected
  e: TA<Integer>; // should pass but it's not ok in FPC! Error: Record type expected
  f: TA<Pointer>; // shouldn't pass and it's half ok. Expected message is - E2512 Type parameter 'T' must be a non-nullable value type!
  g: TA<TObject>; // shouldn't pass and it's half ok. Expected message is - E2512 Type parameter 'T' must be a non-nullable value type!
  h: TA<string>; // shouldn't pass and it's half ok. Expected message is - E2512 Type parameter 'T' must be a non-nullable value type!
  // and so on...
begin
end.  

Mantis conversion info:

  • Mantis ID: 24073
  • Version: 2.7.1
  • Fixed in revision: 35739 (#e4565378)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking