aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2021-05-01 19:55:36 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-06 14:46:51 +0000
commitdaf9bc6aeab822da203c01beb47d2c9e11ab3635 (patch)
treec3f9238c8de96a01a254aa4b015056f537375bc3 /gcc
parent0b2e9514880c304488da80776c77d25e17ef1622 (diff)
downloadgcc-daf9bc6aeab822da203c01beb47d2c9e11ab3635.zip
gcc-daf9bc6aeab822da203c01beb47d2c9e11ab3635.tar.gz
gcc-daf9bc6aeab822da203c01beb47d2c9e11ab3635.tar.bz2
[Ada] Spurious conformance error on expression function
gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not perform conformance check when the subprogram body has been created for an expression function that is not a completion of a previous specification, because the profile of the constructed body is copied from the expression function itself.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch6.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 4b58d59..c7d4b96 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4585,6 +4585,17 @@ package body Sem_Ch6 is
then
Conformant := True;
+ -- Finally, a body generated for an expression function copies
+ -- the profile of the function and no check is needed either.
+ -- If the body is the completion of a previous function
+ -- declared elsewhere, the conformance check is required.
+
+ elsif Nkind (N) = N_Subprogram_Body
+ and then Was_Expression_Function (N)
+ and then Sloc (Spec_Id) = Sloc (Body_Id)
+ then
+ Conformant := True;
+
else
Check_Conformance
(Body_Id, Spec_Id,