mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 12:59:15 +02:00
Mantis #22790 was fixed by partial specializations addition in revision 27861
+ added test git-svn-id: trunk@27894 -
This commit is contained in:
parent
c1fdce5166
commit
69a8445472
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -13791,6 +13791,9 @@ tests/webtbs/tw2274.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw22741.pp svneol=native#text/plain
|
tests/webtbs/tw22741.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw22744.pp svneol=native#text/pascal
|
tests/webtbs/tw22744.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2277.pp svneol=native#text/plain
|
tests/webtbs/tw2277.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw22790a.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw22790b.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw22790c.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw22796.pp svneol=native#text/plain
|
tests/webtbs/tw22796.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2280.pp svneol=native#text/plain
|
tests/webtbs/tw2280.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw22860.pp svneol=native#text/plain
|
tests/webtbs/tw22860.pp svneol=native#text/plain
|
||||||
|
46
tests/webtbs/tw22790a.pp
Normal file
46
tests/webtbs/tw22790a.pp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{ %NORUN }
|
||||||
|
|
||||||
|
program tw22790a;
|
||||||
|
|
||||||
|
{$MODE DELPHI}
|
||||||
|
|
||||||
|
type
|
||||||
|
TBinaryRelationMethod<TOperand> =
|
||||||
|
function (const a, b: TOperand): Boolean of object;
|
||||||
|
|
||||||
|
TWrapper1<TOperand> = record
|
||||||
|
class procedure Sort(lessThan: TBinaryRelationMethod<TOperand>); static;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TWrapper2<TOperand> = class
|
||||||
|
strict private
|
||||||
|
type
|
||||||
|
POperand = ^TOperand;
|
||||||
|
|
||||||
|
TDereferencingAdapter = class
|
||||||
|
function LessThan(const a, b: POperand): Boolean;
|
||||||
|
end;
|
||||||
|
public
|
||||||
|
procedure Sort;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class procedure TWrapper1<TOperand>.Sort(
|
||||||
|
lessThan: TBinaryRelationMethod<TOperand>);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWrapper2<TOperand>.TDereferencingAdapter.LessThan(
|
||||||
|
const a, b: POperand): Boolean;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWrapper2<TOperand>.Sort;
|
||||||
|
begin
|
||||||
|
with TDereferencingAdapter.Create do begin
|
||||||
|
TWrapper1<POperand>.Sort(LessThan); { Error: Incompatible types ... }
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
36
tests/webtbs/tw22790b.pp
Normal file
36
tests/webtbs/tw22790b.pp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{ %NORUN }
|
||||||
|
|
||||||
|
program tw22790b;
|
||||||
|
|
||||||
|
{$MODE DELPHI}
|
||||||
|
|
||||||
|
type
|
||||||
|
TPredicateMethod<TOperand> = function (const x: TOperand): Boolean of object;
|
||||||
|
|
||||||
|
TWrapper<TOperand> = class
|
||||||
|
strict private
|
||||||
|
type
|
||||||
|
POperand = ^TOperand;
|
||||||
|
TDereferencingAdapter = class
|
||||||
|
function F(const x: POperand): Boolean;
|
||||||
|
end;
|
||||||
|
public
|
||||||
|
procedure Z;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWrapper<TOperand>.TDereferencingAdapter.F(const x: POperand): Boolean;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWrapper<TOperand>.Z;
|
||||||
|
var
|
||||||
|
pred: TPredicateMethod<POperand>;
|
||||||
|
begin
|
||||||
|
with TDereferencingAdapter.Create do begin
|
||||||
|
pred := F; { Error: Incompatible types ... }
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
38
tests/webtbs/tw22790c.pp
Normal file
38
tests/webtbs/tw22790c.pp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{ %NORUN }
|
||||||
|
|
||||||
|
program tw22790c;
|
||||||
|
|
||||||
|
{$MODE DELPHI}
|
||||||
|
|
||||||
|
type
|
||||||
|
TPredicateMethod<TOperand> = function (const x: TOperand): Boolean of object;
|
||||||
|
|
||||||
|
TWrapper<TOperand> = class
|
||||||
|
strict private
|
||||||
|
type
|
||||||
|
POperand = ^TOperand;
|
||||||
|
TPredicateMethodForPOperand = TPredicateMethod<POperand>;
|
||||||
|
TDereferencingAdapter = class
|
||||||
|
function F(const x: POperand): Boolean;
|
||||||
|
end;
|
||||||
|
public
|
||||||
|
procedure Z;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWrapper<TOperand>.TDereferencingAdapter.F(const x: POperand): Boolean;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TWrapper<TOperand>.Z;
|
||||||
|
var
|
||||||
|
pred: TPredicateMethodForPOperand;
|
||||||
|
{ Error: Generics without specialization cannot be used as ... }
|
||||||
|
begin
|
||||||
|
with TDereferencingAdapter.Create do begin
|
||||||
|
pred := F;
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user