+2017-01-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Default_Initial_Condition): If the desired type
+ declaration is a derived type declaration with discriminants,
+ it is rewritten as a private type declaration.
+ * sem_ch13.adb (Replace_Type_References_Generic,
+ Visible_Component): A discriminated private type with descriminnts
+ has components that must be rewritten as selected components
+ if they appear as identifiers in an aspect expression such as
+ a Default_Initial_Condition.
+ * sem_util.adb (Defining_Entity): support N_Iterator_Specification
+ nodes.
+
2017-01-23 Hristian Kirtchev <kirtchev@adacore.com>
* ghost.ads, ghost.adb (Is_Ignored_Ghost_Unit): New routine.
E : Entity_Id;
begin
- if Ekind (T) /= E_Record_Type then
- return Empty;
- else
+ -- Types with nameable components are records and discriminated
+ -- private types.
+
+ if Ekind (T) = E_Record_Type
+ or else (Is_Private_Type (T) and then Has_Discriminants (T))
+ then
E := First_Entity (T);
while Present (E) loop
if Comes_From_Source (E) and then Chars (E) = Comp then
Next_Entity (E);
end loop;
-
- return Empty;
end if;
+
+ -- Nothing by that name, or type has no components.
+
+ return Empty;
end Visible_Component;
-- Start of processing for Replace_Type_References_Generic
Error_Msg_N ("pragma % duplicates pragma declared#", N);
end if;
- -- Skip internally generated code
+ -- Skip internally generated code. Note that derived type
+ -- declarations of untagged types with discriminants are
+ -- rewritten as private type declarations.
- elsif not Comes_From_Source (Stmt) then
+ elsif not Comes_From_Source (Stmt)
+ and then Nkind (Stmt) /= N_Private_Type_Declaration
+ then
null;
-- The associated private type [extension] has been found, stop
| N_Full_Type_Declaration
| N_Implicit_Label_Declaration
| N_Incomplete_Type_Declaration
+ | N_Iterator_Specification
| N_Loop_Parameter_Specification
| N_Number_Declaration
| N_Object_Declaration