@@ -16468,10 +16468,15 @@
Type_Scope := Scope (Base_Type (Scope (C)));
- -- This test only concerns tagged types
+ -- For an untagged type derived from a private type, the only
+ -- visible components are new discriminants.
if not Is_Tagged_Type (Original_Scope) then
- return True;
+ return not Has_Private_Ancestor (Original_Scope)
+ or else In_Open_Scopes (Scope (Original_Scope))
+ or else
+ (Ekind (Original_Comp) = E_Discriminant
+ and then Original_Scope = Type_Scope);
-- If it is _Parent or _Tag, there is no visibility issue
@@ -17383,8 +17388,6 @@
-- now. We have to create a new entity with the same name, Thus we
-- can't use Create_Itype.
- -- This is messy, should be fixed ???
Full := Make_Defining_Identifier (Sloc (Id), Chars (Id));
Set_Associated_Node_For_Itype (Full, Related_Nod);
@@ -1753,12 +1753,14 @@
-- is defined for the type.
-- Has_Private_Ancestor (Flag151)
+-- Applies to untagged derived types and to type extensions. True when
+-- some ancestor is derived from a private type, making some components
+-- invisible and aggregates illegal. Used to check the legality of
+-- selected components and aggregates. The flag is set at the point of
+-- The legality of an aggregate of a type with a private ancestor must
+-- be checked because it also depends on the visibility at the point the
+-- aggregate is resolved. See sem_aggr.adb. This is part of AI05-0115.
-- Has_Private_Declaration (Flag155)
-- Defined in all entities. Returns True if it is the defining entity