aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-03-10 10:38:57 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-17 10:32:12 -0400
commit679124db5bc81cca40d33543916cd82981601f06 (patch)
treedb428558bd88437e3791c0f109fc9e31ebc5b5c7 /gcc
parente50d50f0c236e9374cfe6a387b1ea24e5f490682 (diff)
downloadgcc-679124db5bc81cca40d33543916cd82981601f06.zip
gcc-679124db5bc81cca40d33543916cd82981601f06.tar.gz
gcc-679124db5bc81cca40d33543916cd82981601f06.tar.bz2
[Ada] Fix handling of generic types in check for overlapping actuals
gcc/ada/ * sem_warn.adb (Warn_On_Overlapping_Actuals): Ignore formal of generic types, but keep examining other parameters.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_warn.adb17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 1e62d47..6db6d2c 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3741,17 +3741,20 @@ package body Sem_Warn is
Form1 := First_Formal (Subp);
Act1 := First_Actual (N);
while Present (Form1) and then Present (Act1) loop
- if Is_Generic_Type (Etype (Act1)) then
- return;
- end if;
Form2 := Next_Formal (Form1);
Act2 := Next_Actual (Act1);
while Present (Form2) and then Present (Act2) loop
- if Refer_Same_Object (Act1, Act2) then
- if Is_Generic_Type (Etype (Act2)) then
- return;
- end if;
+
+ -- Ignore formals of generic types; they will be examined when
+ -- instantiated.
+
+ if Is_Generic_Type (Etype (Form1))
+ or else Is_Generic_Type (Etype (Form2))
+ then
+ null;
+
+ elsif Refer_Same_Object (Act1, Act2) then
-- Case 1: two writable elementary parameters that overlap