Skip to content

simple class with specialization cause compile error when include sysutils in uses

Summary

simple class with specialization cause compile error when include sysutils in uses

System Information

  • Operating system: Windows 11
  • Processor architecture: x86-64
  • Compiler version: trunk
  • Device: Computer

Steps to reproduce

compile attached sample unit

Example Project

test.pp

unit test;
interface

type
  ftest1 = class
    private
      procedure setValue(value: specialize TArray<String>);
      function getValue(): specialize TArray<String>;
  end;


implementation

uses sysutils; // compile error if uncommented 

procedure ftest1.setValue(value: specialize TArray<String>);
  begin
  end;

function ftest1.getValue(): specialize TArray<String>;
  begin
  end;
  
end.

What is the current bug behavior?

compile error when include "sysutils" in uses under implementation, other includes doesn't result in compile error, only specific to "sysutils".

The issue occur in mode objfpc and delphi

What is the expected (correct) behavior?

compile correctly

Relevant logs and/or screenshots

Free Pascal Compiler version 3.3.1 [2023/05/28] for x86_64
Copyright (c) 1993-2023 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling test.pp
test.pp(16,18) Error: Function header doesn't match any method of this class "setValue(TArray$1$crc640B6513_crcE7A59337);"
test.pp(7,17) Error: Found declaration: setValue(TArray$1$crc640B6513_crcEEEAFAD0);
test.pp(20,17) Error: Overloaded functions have the same parameter list
test.pp(8,16) Error: Found declaration: getValue:TArray$1$crc640B6513_crcEEEAFAD0;
test.pp(20,17) Error: Function header doesn't match any method of this class "getValue:TArray$1$crc640B6513_crcE7A59337;"
test.pp(8,16) Error: Found declaration: getValue:TArray$1$crc640B6513_crcEEEAFAD0;
test.pp(24,4) Fatal: There were 6 errors compiling module, stopping
Fatal: Compilation aborted

Possible fixes

I can trace back the error occurring since revision e050a019

Edited by Christian H
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information