mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 20:33:13 +02:00

htypechk.pas, tcallcandidates: * create_candidate_list: don't check whether the pd is a specialization if the owner is valid; happens if a generic method is used more than once (which should happen here and then :P ) + added test git-svn-id: trunk@33037 -
30 lines
558 B
ObjectPascal
30 lines
558 B
ObjectPascal
{ %NORUN }
|
|
|
|
program tw29546;
|
|
|
|
{$mode objfpc}
|
|
|
|
type
|
|
TUtils = class sealed(TObject)
|
|
public
|
|
generic class function Iif<T>(ACondition: Boolean;
|
|
const ATrueValue, AFalseValue: T): T; static;
|
|
end;
|
|
|
|
generic 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.specialize Iif<string>(False, 'YES', 'NO');
|
|
S := TUtils.specialize Iif<string>(True, 'YES', 'NO');
|
|
end.
|
|
|