+2015-03-02 Robert Dewar <dewar@adacore.com>
+
+ * scng.adb (Scan): Ignore illegal character in relaxed
+ semantics mode.
+
+2015-03-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Analyze_Set_Membership); Retain Overloaded flag
+ on left operand, so it can be properly resolved with type of
+ alternatives of right operand.
+ * sem_res.adb (Resolve_Set_Membership): Handle properly an
+ overloaded left-hand side when the alternatives on the right
+ hand side are literals of some universal type. Use first
+ non-overloaded alternative to find expected type.
+
+2015-03-02 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch7.adb (Make_Set_Finalize_Address_Call): Use underlying
+ type to retrieve designated type, because the purported access
+ type may be a partial (private) view, when it is declared in
+ the private part of a nested package, and finalization actions
+ are generated when completing compilation of enclosing unit.
+
2015-03-02 Robert Dewar <dewar@adacore.com>
* back_end.adb (Call_Back_End): Remove previous patch,
(Loc : Source_Ptr;
Ptr_Typ : Entity_Id) return Node_Id
is
+
+ -- It is possible for Ptr_Typ to be a partial view, if the access
+ -- type is a full view declared in the private part of a nested package,
+ -- and the finalization actions take place when completing analysis
+ -- of the enclosing unit. For this reason we use Underlying_Type
+ -- in two places below.
+
Desig_Typ : constant Entity_Id :=
- Available_View (Designated_Type (Ptr_Typ));
+ Available_View
+ (Designated_Type (Underlying_Type (Ptr_Typ)));
Fin_Addr : constant Entity_Id := Finalize_Address (Desig_Typ);
- Fin_Mas : constant Entity_Id := Finalization_Master (Ptr_Typ);
+ Fin_Mas : constant Entity_Id :=
+ Finalization_Master (Underlying_Type (Ptr_Typ));
begin
-- Both the finalization master and primitive Finalize_Address must be
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
then
Scan_Ptr := Scan_Ptr + 1;
- -- Otherwise we have an illegal comment character
+ -- Otherwise we have an illegal comment character, ignore
+ -- this error in relaxed semantics mode.
else
- Error_Illegal_Character;
+ if Relaxed_RM_Semantics then
+ Scan_Ptr := Scan_Ptr + 1;
+ else
+ Error_Illegal_Character;
+ end if;
end if;
end loop;
if Present (Common_Type) then
Set_Etype (L, Common_Type);
- Set_Is_Overloaded (L, False);
+
+ -- The left operand may still be overloaded, to be resolved using
+ -- the Common_Type.
else
Error_Msg_N ("cannot resolve membership operation", N);
procedure Resolve_Set_Membership is
Alt : Node_Id;
- Ltyp : constant Entity_Id := Etype (L);
+ Ltyp : Entity_Id;
begin
+ -- If the left operand is overloaded, find type compatible with not
+ -- overloaded alternative of the right operand.
+
+ if Is_Overloaded (L) then
+ Ltyp := Empty;
+ Alt := First (Alternatives (N));
+ while Present (Alt) loop
+ if not Is_Overloaded (Alt) then
+ Ltyp := Intersect_Types (L, Alt);
+ exit;
+ else
+ Next (Alt);
+ end if;
+ end loop;
+
+ -- Unclear how to resolve expression if all alternatives are also
+ -- overloaded.
+
+ if No (Ltyp) then
+ Error_Msg_N ("ambiguous expression", N);
+ end if;
+
+ else
+ Ltyp := Etype (L);
+ end if;
+
Resolve (L, Ltyp);
Alt := First (Alternatives (N));