+2017-01-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Try_Primitive_Operations,
+ Is_Valid_First_Argument_Of): argument is valid if it is a derived
+ type with unknown discriminants that matches its underlying
+ record view.
+ * exp_util.adb (Expand_Subtype_From_Expr): Do not expand
+ expression if its type is derived from a limited type with
+ unknown discriminants, because the expansion (which is a call)
+ must be expanded in the enclosing context to add the proper build-
+ in-place parameters to the call.
+ * lib.ads, exp_ch9.adb: Minor fixes in comments.
+
2017-01-23 Yannick Moy <moy@adacore.com>
* frontend.adb (Frontend): Do not load runtime
Op_Body := First (Declarations (N));
- -- The protected body is replaced with the bodies of its
- -- protected operations, and the declarations for internal objects
- -- that may have been created for entry family bounds.
+ -- The protected body is replaced with the bodies of its protected
+ -- operations, and the declarations for internal objects that may
+ -- have been created for entry family bounds.
Rewrite (N, Make_Null_Statement (Sloc (N)));
Analyze (N);
then
-- Nothing to be done if no underlying record view available
- if No (Underlying_Record_View (Unc_Type)) then
+ -- If this is a limited type derived from a type with unknown
+ -- discriminants, do not expand either, so that subsequent
+ -- expansion of the call can add build-in-place parameters to call.
+
+ if No (Underlying_Record_View (Unc_Type))
+ or else Is_Limited_Type (Unc_Type)
+ then
null;
-- Otherwise use the Underlying_Record_View to create the proper
-- No_Name for the main unit.
-- Fatal_Error
- -- A flag that is initialized to None and gets set to Errorif a fatal
+ -- A flag that is initialized to None and gets set to Error if a fatal
-- error occurs during the processing of a unit. A fatal error is one
-- defined as serious enough to stop the next phase of the compiler
-- from running (i.e. fatal error during parsing stops semantics,
or else Base_Type (Obj_Type) = Typ
or else Corr_Type = Typ
+ -- Object may be of a derived type whose parent has unknown
+ -- discriminants, in which case the type matches the
+ -- underlying record view of its base.
+
+ or else (Has_Unknown_Discriminants (Typ)
+ and then Typ = Underlying_Record_View (Base_Type (Obj_Type)))
+
-- Prefix can be dereferenced
or else