mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-25 05:30:25 +08:00
[multiple changes]
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. From-SVN: r221116
This commit is contained in:
parent
89f0276a49
commit
cd1a470ab2
@ -1,3 +1,26 @@
|
||||
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,
|
||||
|
@ -7853,10 +7853,19 @@ package body Exp_Ch7 is
|
||||
(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
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- 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- --
|
||||
@ -1757,10 +1757,15 @@ package body Scng is
|
||||
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;
|
||||
|
||||
|
@ -2683,7 +2683,9 @@ package body Sem_Ch4 is
|
||||
|
||||
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);
|
||||
|
@ -8593,9 +8593,35 @@ package body Sem_Res is
|
||||
|
||||
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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user