mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 06:29:32 +02:00
Fix for Mantis #29546.
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 -
This commit is contained in:
parent
ed94ca4b24
commit
05174f3e67
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14933,6 +14933,7 @@ tests/webtbs/tw2944.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2946.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2949.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2953.pp svneol=native#text/plain
|
||||
tests/webtbs/tw29546.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2956.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2958.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2966.pp svneol=native#text/plain
|
||||
|
@ -2472,10 +2472,7 @@ implementation
|
||||
)
|
||||
) or
|
||||
(
|
||||
(
|
||||
not pd.is_specialization and
|
||||
assigned(pd.owner)
|
||||
) and
|
||||
assigned(pd.owner) and
|
||||
(
|
||||
not (pd.owner.symtabletype in [objectsymtable,recordsymtable]) or
|
||||
is_visible_for_object(pd,contextstructdef)
|
||||
|
29
tests/webtbs/tw29546.pp
Normal file
29
tests/webtbs/tw29546.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{ %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.
|
||||
|
Loading…
Reference in New Issue
Block a user