public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2054] [Ada] Spurious conformance error on expression function
@ 2021-07-06 14:48 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-06 14:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:daf9bc6aeab822da203c01beb47d2c9e11ab3635
commit r12-2054-gdaf9bc6aeab822da203c01beb47d2c9e11ab3635
Author: Ed Schonberg <schonberg@adacore.com>
Date: Sat May 1 19:55:36 2021 -0400
[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.
Diff:
---
gcc/ada/sem_ch6.adb | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 4b58d593733..c7d4b961d47 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,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-06 14:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 14:48 [gcc r12-2054] [Ada] Spurious conformance error on expression function Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).