mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 07:34:28 +02:00
Mantis #23279 was fixed by partial specializations addition in revision 27861
+ added test git-svn-id: trunk@27896 -
This commit is contained in:
parent
1a22175553
commit
47407d2d7a
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13824,6 +13824,7 @@ tests/webtbs/tw23204.pp svneol=native#text/plain
|
||||
tests/webtbs/tw23212.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2323.pp svneol=native#text/plain
|
||||
tests/webtbs/tw23270.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw23279.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2328.pp svneol=native#text/plain
|
||||
tests/webtbs/tw23299.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2332.pp svneol=native#text/plain
|
||||
|
70
tests/webtbs/tw23279.pp
Normal file
70
tests/webtbs/tw23279.pp
Normal file
@ -0,0 +1,70 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tw23279;
|
||||
|
||||
{$MODE DELPHI}
|
||||
|
||||
type
|
||||
TPolicy<T> = class abstract
|
||||
procedure Z(const a: T); virtual; abstract;
|
||||
end;
|
||||
|
||||
TWrapper<T, S> = class
|
||||
private
|
||||
FPolicy: TPolicy<T>;
|
||||
public
|
||||
constructor Create(policy: TPolicy<T>);
|
||||
procedure W(const a: T);
|
||||
end;
|
||||
|
||||
TSpecialWrapper<S> = class(TWrapper<Integer, S>)
|
||||
strict private
|
||||
type
|
||||
TSpecialPolicy = class(TPolicy<Integer>)
|
||||
procedure Z(const a: Integer); override;
|
||||
end;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
{ TWrapper<T, S> }
|
||||
|
||||
constructor TWrapper<T, S>.Create;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWrapper<T, S>.W(const a: T);
|
||||
begin
|
||||
FPolicy.Z(a);
|
||||
end;
|
||||
|
||||
{ TSpecialWrapper<S>.TSpecialPolicy }
|
||||
|
||||
procedure TSpecialWrapper<S>.TSpecialPolicy.Z(const a: Integer);
|
||||
begin
|
||||
Writeln(a);
|
||||
end;
|
||||
|
||||
{ TSpecialWrapper<S> }
|
||||
|
||||
constructor TSpecialWrapper<S>.Create;
|
||||
begin
|
||||
inherited Create(TSpecialPolicy.Create);
|
||||
{ Warning: Constructing a class "TSpecialPolicy" with abstract method "Z";
|
||||
if Z() is CLASS or CLASS STATIC the warning is suppressed but the code
|
||||
is still faulty }
|
||||
end;
|
||||
|
||||
destructor TSpecialWrapper<S>.Destroy;
|
||||
begin
|
||||
FPolicy.Free;
|
||||
end;
|
||||
|
||||
begin
|
||||
with TSpecialWrapper<Byte>.Create do begin
|
||||
W(0);
|
||||
Free;
|
||||
end;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user