summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-04 07:57:40 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-04 07:57:40 +0000
commitfd71e467be895e8334c36f5a33b5e15464a6674e (patch)
tree9dba4c2c474be1f9b2df2220eaf2ff37f785c8db
parent124f1911c5db13995ad42be5ed967aae91aea244 (diff)
downloadgcc-fd71e467be895e8334c36f5a33b5e15464a6674e.tar.gz
2014-08-04 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch8.adb (Build_Class_Wide_Wrapper): Mark the primitive as referenced once resolution has taken place. 2014-08-04 Gary Dismukes <dismukes@adacore.com> * exp_ch4.adb (Expand_N_Type_Conversion): Don't compare access levels in the case where the target type is the anonymous type of an access discriminant, since the level of such types is defined based on context. Add comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213534 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/exp_ch4.adb20
-rw-r--r--gcc/ada/sem_ch8.adb7
3 files changed, 32 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a979ec7424e..8f2243eb947 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,17 @@
2014-08-04 Hristian Kirtchev <kirtchev@adacore.com>
+ * sem_ch8.adb (Build_Class_Wide_Wrapper): Mark the primitive as
+ referenced once resolution has taken place.
+
+2014-08-04 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Type_Conversion): Don't
+ compare access levels in the case where the target type is the
+ anonymous type of an access discriminant, since the level of
+ such types is defined based on context. Add comment.
+
+2014-08-04 Hristian Kirtchev <kirtchev@adacore.com>
+
* sem_ch8.adb (Build_Class_Wide_Wrapper): Handle various special
cases related to equality. Remove the special processing
for dispatching abstract subprograms as it is not needed.
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 7123389b813..6d43496d419 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -10417,12 +10417,24 @@ package body Exp_Ch4 is
-- level of the target type, then force Program_Error. Note that this
-- can only occur for cases where the attribute is within the body of
-- an instantiation (otherwise the conversion will already have been
- -- rejected as illegal). Note: warnings are issued by the analyzer
- -- for the instance cases.
+ -- rejected as illegal). (Note: warnings are issued by the analyzer
+ -- for the instance cases.) The case where the target type is an
+ -- anonymous access type of a discriminant is excluded, because the
+ -- level of such a type depends on the context and currently the
+ -- level returned for such types is zero, resulting in warnings about
+ -- about check failures in certain legal cases involving class-wide
+ -- interfaces as the designated type (some cases, such as return
+ -- statements, are checked at run time, but not clear if these are
+ -- handled right in general, see 3.10.2(12/2-12.5/3) ???).
elsif In_Instance_Body
- and then Type_Access_Level (Operand_Type) >
- Type_Access_Level (Target_Type)
+ and then
+ not (Ekind (Target_Type) = E_Anonymous_Access_Type
+ and then Present (Associated_Node_For_Itype (Target_Type))
+ and then Nkind (Associated_Node_For_Itype (Target_Type)) =
+ N_Discriminant_Specification)
+ and then
+ Type_Access_Level (Operand_Type) > Type_Access_Level (Target_Type)
then
Raise_Accessibility_Error;
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 97518b31482..0780f3f5921 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -2290,12 +2290,13 @@ package body Sem_Ch8 is
return;
end if;
- -- Set the proper entity of the renamed generic formal subprogram
- -- and reset its overloaded status now that resolution has finally
- -- taken place.
+ -- Set the proper entity of the renamed generic formal subprogram,
+ -- reset its overloaded status and mark the primitive as referenced
+ -- now that resolution has finally taken place.
Set_Entity (Nam, Prim_Op);
Set_Is_Overloaded (Nam, False);
+ Set_Referenced (Prim_Op);
-- Step 3: Create the declaration and the body of the wrapper, insert
-- all the pieces into the tree.