aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2015-05-28 10:48:29 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2015-05-28 12:48:29 +0200
commit4d6a38a56ee18d4bbfe451206ce1e5c041c5ccb7 (patch)
tree6a53879ef2ea6f4d4f74d2e4eb820b3f62cb5f2a
parent9fb5fd444bef7601aec09778bc6ee926a6f76fd4 (diff)
downloadgcc-4d6a38a56ee18d4bbfe451206ce1e5c041c5ccb7.zip
gcc-4d6a38a56ee18d4bbfe451206ce1e5c041c5ccb7.tar.gz
gcc-4d6a38a56ee18d4bbfe451206ce1e5c041c5ccb7.tar.bz2
sem_util.adb (Wrong_Type): In any instance...
2015-05-28 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Wrong_Type): In any instance, do not emit error if type of expression is the partial view of the expected type. 2015-05-28 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Actuals): a) The replacement of formal names in named associations only needs to be done within an instance, on a call to a primitive of a formal derived type, where the actual subprogram may have different formal names than those of the primitive operation of the formal type. b) Defaulted parameters must be taken into account when obtaining the names of the formals of the actual subprogram being called. From-SVN: r223804
-rw-r--r--gcc/ada/ChangeLog15
-rw-r--r--gcc/ada/sem_res.adb20
-rw-r--r--gcc/ada/sem_util.adb9
3 files changed, 35 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c9f142f..c618018 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,18 @@
+2015-05-28 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Wrong_Type): In any instance, do not emit error
+ if type of expression is the partial view of the expected type.
+
+2015-05-28 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Actuals): a) The replacement of formal
+ names in named associations only needs to be done within an
+ instance, on a call to a primitive of a formal derived type,
+ where the actual subprogram may have different formal names than
+ those of the primitive operation of the formal type.
+ b) Defaulted parameters must be taken into account when obtaining
+ the names of the formals of the actual subprogram being called.
+
2015-05-28 Robert Dewar <dewar@adacore.com>
* sem_ch13.adb, sem_disp.ads: Minor reformatting.
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 0e92867..9492fff 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3053,11 +3053,12 @@ package body Sem_Res is
Real_F : Entity_Id;
Real_Subp : Entity_Id;
- -- If the subprogram being called is an overridden operation,
- -- Real_Subp is the subprogram that will be called. It may have
- -- different formal names than the overridden operation, so after
- -- actual is resolved, the name of the actual in a named association
- -- must carry the name of the actual of the subprogram being called.
+ -- If the subprogram being called is an inherited operation for
+ -- a formal derived type in an instance, Real_Subp is the subprogram
+ -- that will be called. It may have different formal names than the
+ -- operation of the formal in the generic, so after actual is resolved
+ -- the name of the actual in a named association must carry the name
+ -- of the actual of the subprogram being called.
procedure Check_Aliased_Parameter;
-- Check rules on aliased parameters and related accessibility rules
@@ -3569,6 +3570,7 @@ package body Sem_Res is
if Is_Overloadable (Nam)
and then Is_Inherited_Operation (Nam)
+ and then In_Instance
and then Present (Alias (Nam))
and then Present (Overridden_Operation (Alias (Nam)))
then
@@ -4534,10 +4536,6 @@ package body Sem_Res is
Next_Actual (A);
- if Present (Real_Subp) then
- Next_Formal (Real_F);
- end if;
-
-- Case where actual is not present
else
@@ -4545,6 +4543,10 @@ package body Sem_Res is
end if;
Next_Formal (F);
+
+ if Present (Real_Subp) then
+ Next_Formal (Real_F);
+ end if;
end loop;
end Resolve_Actuals;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index d749ea1..3fe6d67 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -19027,6 +19027,15 @@ package body Sem_Util is
and then Covers (Full_View (Expected_Type), Etype (Expr))
then
return;
+
+ -- Conversely, type of expression may be the private one.
+
+ elsif Is_Private_Type (Base_Type (Etype (Expr)))
+ and then Full_View (Base_Type (Etype (Expr))) =
+ Expected_Type
+ then
+ return;
+
end if;
end if;