+2014-07-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Check_Return_Subtype_Indication): Reject a return
+ subtype indication in an extended return statement when the
+ return value is an ancestor of the return type of the function,
+ and that return type is a null record extension.
+
+2014-07-29 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch13.adb (Rep_Item_Too_Late): Specialize/clarify error
+ message produced for the case of a type-related representation
+ item that is made illegal by 13.10(1).
+ * gnat_rm.texi (Scalar_Storage_Order): Minor change in
+ documentation.
+
2014-07-29 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Add section on Wide_Wide_Character encodings.
Other properties are as for standard representation attribute @code{Bit_Order},
as defined by Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
-For a record type @var{S}, if @code{@var{S}'Scalar_Storage_Order} is
-specified explicitly, it shall be equal to @code{@var{S}'Bit_Order}. Note:
+For a record type @var{T}, if @code{@var{T}'Scalar_Storage_Order} is
+specified explicitly, it shall be equal to @code{@var{T}'Bit_Order}. Note:
this means that if a @code{Scalar_Storage_Order} attribute definition
clause is not confirming, then the type's @code{Bit_Order} shall be
specified explicitly and set to the same value.
storage order for the derived type. For a record extension, the derived type
must have the same scalar storage order as the parent type.
-If a component of @var{S} is of a record or array type, then that type must
+If a component of @var{T} is of a record or array type, then that type must
also have a @code{Scalar_Storage_Order} attribute definition clause.
A component of a record or array type that is a packed array, or that
S : Entity_Id;
Parent_Type : Entity_Id;
+ procedure No_Type_Rep_Item;
+ -- Output message indicating that no type-related aspects can be
+ -- specified due to some property of the parent type.
+
procedure Too_Late;
- -- Output the too late message. Note that this is not considered a
- -- serious error, since the effect is simply that we ignore the
- -- representation clause in this case.
+ -- Output message for an aspect being specified too late
+
+ -- Note that neither of the above errors is considered a serious one,
+ -- since the effect is simply that we ignore the representation clause
+ -- in these cases.
+
+ ----------------------
+ -- No_Type_Rep_Item --
+ ----------------------
+
+ procedure No_Type_Rep_Item is
+ begin
+ Error_Msg_N ("|type-related representation item not permitted!", N);
+ end No_Type_Rep_Item;
--------------
-- Too_Late --
return True;
-- Check for case of non-tagged derived type whose parent either has
- -- primitive operations, or is a by reference type (RM 13.1(10)).
+ -- primitive operations, or is a by reference type (RM 13.1(10)). In
+ -- this case we do not output a Too_Late message, since there is no
+ -- earlier point where the rep item could be placed to make it legal.
elsif Is_Type (T)
and then not FOnly
Parent_Type := Etype (Base_Type (T));
if Has_Primitive_Operations (Parent_Type) then
- Too_Late;
+ No_Type_Rep_Item;
Error_Msg_NE
- ("primitive operations already defined for&!", N, Parent_Type);
+ ("\parent type & has primitive operations!", N, Parent_Type);
return True;
elsif Is_By_Reference_Type (Parent_Type) then
- Too_Late;
+ No_Type_Rep_Item;
Error_Msg_NE
- ("parent type & is a by reference type!", N, Parent_Type);
+ ("\parent type & is a by reference type!", N, Parent_Type);
return True;
end if;
end if;
end if;
end if;
- elsif Etype (Base_Type (R_Type)) = R_Stm_Type
- and then Is_Null_Extension (Base_Type (R_Type))
- then
- null;
+ -- Previous versions of this subprogram allowed the return value
+ -- to be the ancestor of the return type if the return type was
+ -- a null extension. This was plainly incorrect.
else
Error_Msg_N
is
AO : constant Entity_Id := Alias (Old_E);
AN : constant Entity_Id := Alias (New_E);
-
begin
return Scope (AO) /= Scope (AN)
or else No (DTC_Entity (AO))
or else Is_Abstract_Subprogram (S)
or else
(Is_Dispatching_Operation (E)
- and then Is_Overriding_Alias (E, S)))
+ and then Is_Overriding_Alias (E, S)))
and then Ekind (E) /= E_Enumeration_Literal
then
-- When an derived operation is overloaded it may be due to
and then Is_Access_Constant (Etype (Default))
then
Error_Msg_N
- ("formal that is access to variable cannot be initialized " &
- "with an access-to-constant expression", Default);
+ ("formal that is access to variable cannot be initialized "
+ & "with an access-to-constant expression", Default);
end if;
-- Check that the designated type of an access parameter's default
-------------------------
procedure Set_Actual_Subtypes (N : Node_Id; Subp : Entity_Id) is
- Decl : Node_Id;
- Formal : Entity_Id;
- T : Entity_Id;
- First_Stmt : Node_Id := Empty;
- AS_Needed : Boolean;
+ Decl : Node_Id;
+ Formal : Entity_Id;
+ T : Entity_Id;
+ First_Stmt : Node_Id := Empty;
+ AS_Needed : Boolean;
begin
-- If this is an empty initialization procedure, no need to create
Result : Boolean;
begin
May_Hide_Profile := False;
-
Check_Conformance
(New_Id, Old_Id, Type_Conformant, False, Result,
Skip_Controlling_Formals => Skip_Controlling_Formals);
-- For function instantiations that are operators, we must check
-- separately that the corresponding generic only has in-parameters.
- -- For subprogram declarations this is done in Set_Formal_Mode.
- -- Such an error could not arise in earlier versions of the language.
+ -- For subprogram declarations this is done in Set_Formal_Mode. Such
+ -- an error could not arise in earlier versions of the language.
elsif Ekind (F) /= E_In_Parameter then
- Error_Msg_N
- ("operators can only have IN parameters", F);
+ Error_Msg_N ("operators can only have IN parameters", F);
end if;
Next_Formal (F);
and then not Is_Intrinsic_Subprogram (Designator)
then
Error_Msg_N
- ("explicit definition of inequality not allowed", Designator);
+ ("explicit definition of inequality not allowed", Designator);
end if;
end Valid_Operator_Definition;