aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-05-12 20:20:16 +0200
committerEric Botcazou <ebotcazou@adacore.com>2023-09-27 10:16:28 +0200
commit5c685fd7e66bb8cb375d73b0953d902783ea7d5d (patch)
tree3802eb0060e9f8e7aa91b07bd7aea39b8b55feef /gcc
parent57b71c70689ba0d5490fc7bfae6230257c985985 (diff)
downloadgcc-5c685fd7e66bb8cb375d73b0953d902783ea7d5d.zip
gcc-5c685fd7e66bb8cb375d73b0953d902783ea7d5d.tar.gz
gcc-5c685fd7e66bb8cb375d73b0953d902783ea7d5d.tar.bz2
ada: Fix missing error on function call returning incomplete view
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch4.adb6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 8525565..3df5395 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -1539,8 +1539,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)));