View Issue Details

IDProjectCategoryView StatusLast Update
0029546FPCRTLpublic2016-01-31 18:49
Reportersilvioprog Assigned ToSven Barth  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.1.1 
Fixed in Version3.1.1 
Summary0029546: Generic problem: function Iif<T> ... : Wrong number of parameters specified for call to "Iif$1"
DescriptionHello,

FPC can't compile inline generic specialization:

project1.exe: Exit code 1, Errors: 2
project1.lpr(25,45) Error: Wrong number of parameters specified for call to "Iif$1"
project1.lpr(12,25) Error: Found declaration: class Iif$1(Boolean;const T;const T):<undefined type>; Static;
Steps To ReproduceJust try to compile the code below:

program Project1;

{$mode delphi}

type
  TUtils = class sealed(TObject)
  public
    class function Iif<T>(ACondition: Boolean;
      const ATrueValue, AFalseValue: T): T; static;
  end;

  class function TUtils.Iif<T>(ACondition: Boolean;
    const ATrueValue, AFalseValue: T): T;
  begin
    if ACondition then
      Result := ATrueValue
    else
      Result := AFalseValue;
  end;

var
  S: string;
begin
  S := TUtils.Iif<string>(False, 'YES', 'NO');
  S := TUtils.Iif<string>(True, 'YES', 'NO');
end.
Tagsgenerics
Fixed in Revision33037
FPCOldBugId
FPCTarget
Attached Files

Activities

silvioprog

2016-01-31 02:01

reporter   ~0089568

this code should be added as a test-case.

Sven Barth

2016-01-31 18:16

manager   ~0089625

You know... it comes across a bit of rude if you demand us to add this as a test case, cause we add all tests from the bug tracker to the test suite if reasonably possible (look at tests/webtbs and tests/webtbf)...

Anyway... please test and close if okay.

Regards,
Sven

silvioprog

2016-01-31 18:49

reporter   ~0089630

Fixed. Thanks a lot buddy! :-)

Issue History

Date Modified Username Field Change
2016-01-31 01:54 silvioprog New Issue
2016-01-31 01:58 Cyrax Tag Attached: generics
2016-01-31 02:01 silvioprog Note Added: 0089568
2016-01-31 18:06 Sven Barth Assigned To => Sven Barth
2016-01-31 18:06 Sven Barth Status new => assigned
2016-01-31 18:16 Sven Barth Fixed in Revision => 33037
2016-01-31 18:16 Sven Barth Note Added: 0089625
2016-01-31 18:16 Sven Barth Status assigned => resolved
2016-01-31 18:16 Sven Barth Fixed in Version => 3.1.1
2016-01-31 18:16 Sven Barth Resolution open => fixed
2016-01-31 18:49 silvioprog Note Added: 0089630
2016-01-31 18:49 silvioprog Status resolved => closed