mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 11:38:19 +02:00
* fix #40634 the 2nd: a (strict) protected symbol in a parent class of the owner is supposed to be visible
+ added test
This commit is contained in:
parent
5e05630713
commit
ea102d792f
@ -3277,6 +3277,23 @@ implementation
|
||||
end;
|
||||
|
||||
function check_strict_protected:boolean;
|
||||
|
||||
function owner_hierarchy_related(nested,check:tabstractrecorddef):boolean;
|
||||
var
|
||||
owner:tabstractrecorddef;
|
||||
begin
|
||||
result:=true;
|
||||
repeat
|
||||
if def_is_related(nested,check) then
|
||||
exit;
|
||||
if nested.owner.symtabletype in [recordsymtable,objectsymtable] then
|
||||
nested:=tabstractrecorddef(nested.owner.defowner)
|
||||
else
|
||||
break;
|
||||
until not assigned(nested);
|
||||
result:=false;
|
||||
end;
|
||||
|
||||
begin
|
||||
result:=(
|
||||
{ access from nested class (specialization case) }
|
||||
@ -3293,7 +3310,7 @@ implementation
|
||||
{ access from child class (specialization case) }
|
||||
assigned(contextobjdef) and
|
||||
assigned(curstruct) and
|
||||
def_is_related(contextobjdef,symownerdef) and
|
||||
owner_hierarchy_related(contextobjdef,symownerdef) and
|
||||
def_is_related(curstruct,contextobjdef)
|
||||
) or
|
||||
(
|
||||
@ -3304,7 +3321,7 @@ implementation
|
||||
(orgsymownerdef<>symownerdef)
|
||||
) and
|
||||
assigned(curstruct) and
|
||||
def_is_related(orgcontextobjdef,orgsymownerdef) and
|
||||
owner_hierarchy_related(orgcontextobjdef,orgsymownerdef) and
|
||||
def_is_related(curstruct,orgcontextobjdef)
|
||||
) or
|
||||
(
|
||||
|
20
tests/webtbs/tw40634b.pp
Normal file
20
tests/webtbs/tw40634b.pp
Normal file
@ -0,0 +1,20 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tw40634b;
|
||||
{$mode ObjFPC}{$H+}
|
||||
uses uw40634c;
|
||||
type
|
||||
TFpThreadWorkerItem = class
|
||||
end;
|
||||
|
||||
TFpThreadWorkerQueue = class(specialize TLazThreadedQueue<TFpThreadWorkerItem>)
|
||||
protected type
|
||||
TFpDbgTypedFifoQueue = class(TLazTypedFifoQueue)
|
||||
//function PushItem(const AItem: TFpThreadWorkerItem): Boolean; override;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
end.
|
||||
|
27
tests/webtbs/uw40634c.pp
Normal file
27
tests/webtbs/uw40634c.pp
Normal file
@ -0,0 +1,27 @@
|
||||
unit uw40634c;
|
||||
{$mode ObjFPC}{$H+}
|
||||
interface
|
||||
|
||||
type
|
||||
|
||||
generic TLazFifoQueue<T> = class
|
||||
private
|
||||
FList: array of T;
|
||||
FQueueSize: integer;
|
||||
//protected
|
||||
// function PushItem(const AItem: TFpThreadWorkerItem): Boolean; virtual;
|
||||
end;
|
||||
|
||||
{ TLazThreadedQueue }
|
||||
|
||||
generic TLazThreadedQueue<T> = class
|
||||
protected
|
||||
type
|
||||
TLazTypedFifoQueue = specialize TLazFifoQueue<T>;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user