summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2019-12-18 07:14:59 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-12-18 07:14:59 +0000
commita760d142461694eca613c9d9a19333416566241e (patch)
tree6c274cdd5fd2397d6f5503d0c7ac377cce3b0e68 /gcc/ada
parent64c6e3673a9eddf168fbe8d5cfab70f55fea08f8 (diff)
[Ada] Missing accessibility actuals on calls to interface conversion functions
2019-12-18 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * sem_res.adb (Resolve_Type_Conversion): Add handling for access types with designated operand and target types that are referenced in places that have a limited view of an interface type by retrieving the nonlimited view when it exists. Add ??? comments related to missing limited_with_clause handling for Target (in the non-access case). From-SVN: r279513
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/sem_res.adb27
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index fd3d0be0edd..acf3b3b5167 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+2019-12-18 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_res.adb (Resolve_Type_Conversion): Add handling for access
+ types with designated operand and target types that are
+ referenced in places that have a limited view of an interface
+ type by retrieving the nonlimited view when it exists. Add ???
+ comments related to missing limited_with_clause handling for
+ Target (in the non-access case).
+
2019-12-18 Ed Schonberg <schonberg@adacore.com>
* par-ch12.adb (P_Formal_Derived_Type_Definition): In Ada_2020
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 32d9fadac07..21cbe0aa8a5 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -11827,12 +11827,35 @@ package body Sem_Res is
Set_Etype (Expression (N), Opnd);
end if;
+ -- It seems that Non_Limited_View should also be applied for
+ -- Target when it has a limited view, but that leads to missing
+ -- error checks on interface conversions further below. ???
+
if Is_Access_Type (Opnd) then
Opnd := Designated_Type (Opnd);
+
+ -- If the type of the operand is a limited view, use nonlimited
+ -- view when available. If it is a class-wide type, recover the
+ -- class-wide type of the nonlimited view.
+
+ if From_Limited_With (Opnd)
+ and then Has_Non_Limited_View (Opnd)
+ then
+ Opnd := Non_Limited_View (Opnd);
+ end if;
end if;
if Is_Access_Type (Target_Typ) then
Target := Designated_Type (Target);
+
+ -- If the target type is a limited view, use nonlimited view
+ -- when available.
+
+ if From_Limited_With (Target)
+ and then Has_Non_Limited_View (Target)
+ then
+ Target := Non_Limited_View (Target);
+ end if;
end if;
if Opnd = Target then
@@ -11840,6 +11863,10 @@ package body Sem_Res is
-- Conversion from interface type
+ -- It seems that it would be better for the error checks below
+ -- to be performed as part of Validate_Conversion (and maybe some
+ -- of the error checks above could be moved as well?). ???
+
elsif Is_Interface (Opnd) then
-- Ada 2005 (AI-217): Handle entities from limited views