if Nkind (N) = N_Object_Declaration
and then Present (Expression (N))
then
+ Error_Msg_Sloc := Sloc (Defining_Identifier (N));
+ Error_Msg_N
+ ("no initialization allowed for declaration of& #",
+ Defining_Identifier (N));
Error_Msg_N
("imported entities cannot be initialized "
& "(RM B.1(24))", Expression (N));
-- initialization generated by the code generator, e.g. for an
-- access type, does not count here.
- elsif Present (Expression (Parent (Def_Id)))
- and then
- Comes_From_Source
- (Original_Node (Expression (Parent (Def_Id))))
+ elsif (Present (Expression (Parent (Def_Id)))
+ and then
+ Comes_From_Source
+ (Original_Node (Expression (Parent (Def_Id)))))
+ or else Has_Init_Expression (Parent (Def_Id))
then
Error_Msg_Sloc := Sloc (Def_Id);
Error_Pragma_Arg
- ("imported entities cannot be initialized (RM B.1(24))",
- "\no initialization allowed for & declared#", Arg1);
+ ("no initialization allowed for declaration of& #",
+ "\imported entities cannot be initialized (RM B.1(24))",
+ Arg1);
else
Set_Imported (Def_Id);
Note_Possible_Modification (Arg_Internal, Sure => False);
-- only counts if it comes from source, otherwise it is simply
-- the code generator making an implicit initialization explicit.
- elsif Present (Expression (Parent (Def_Id)))
- and then Comes_From_Source
- (Original_Node (Expression (Parent (Def_Id))))
+ elsif (Present (Expression (Parent (Def_Id)))
+ and then Comes_From_Source
+ (Original_Node (Expression (Parent (Def_Id)))))
+ or else Has_Init_Expression (Parent (Def_Id))
then
-- Set imported flag to prevent cascaded errors