* [COMMITTED] ada: Fix missing error on function call returning incomplete view
@ 2023-06-15 8:04 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-06-15 8:04 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
Testing for the presence of Non_Limited_View is not sufficient to detect
whether the nonlimited view has been analyzed because Build_Limited_Views
always sets the field on the limited view. Instead the discriminant is
whether this nonlimited view is itself an incomplete type.
gcc/ada/
* sem_ch4.adb (Analyze_Call): Adjust the test to detect the presence
of an incomplete view of a type on a function call.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch4.adb | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 02c59284994..b4b158a3ff4 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -1540,8 +1540,14 @@ package body Sem_Ch4 is
Set_Etype (N, Full_View (Etype (N)));
+ -- If the call is within a thunk, the nonlimited view should be
+ -- analyzed eventually (see also Analyze_Return_Type).
+
elsif From_Limited_With (Etype (N))
and then Present (Non_Limited_View (Etype (N)))
+ and then
+ (Ekind (Non_Limited_View (Etype (N))) /= E_Incomplete_Type
+ or else Is_Thunk (Current_Scope))
then
Set_Etype (N, Non_Limited_View (Etype (N)));
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-15 8:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15 8:04 [COMMITTED] ada: Fix missing error on function call returning incomplete view Marc Poulhiès
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).