mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 23:31:49 +02:00
+ test from Rika for merge request 458
This commit is contained in:
parent
dde19c0144
commit
cc27a5de78
32
tests/tbs/tb0707.pp
Normal file
32
tests/tbs/tb0707.pp
Normal file
@ -0,0 +1,32 @@
|
||||
{$mode objfpc} {$modeswitch advancedrecords}
|
||||
var
|
||||
initialized: boolean = false;
|
||||
|
||||
type
|
||||
InnerRec = record
|
||||
class operator Initialize(var self: InnerRec);
|
||||
end;
|
||||
|
||||
OuterRec = record
|
||||
inner: InnerRec;
|
||||
class operator Initialize(var self: OuterRec);
|
||||
end;
|
||||
|
||||
class operator InnerRec.Initialize(var self: InnerRec);
|
||||
begin
|
||||
initialized := true;
|
||||
end;
|
||||
|
||||
class operator OuterRec.Initialize(var self: OuterRec);
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
Initialize(OuterRec(nil^));
|
||||
if not initialized then
|
||||
begin
|
||||
writeln('Inner record not initialized.');
|
||||
halt(1);
|
||||
end;
|
||||
writeln('ok');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user