aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index c58a548..495e8b1 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -857,6 +857,14 @@ package body Sem_Ch6 is
end if;
Resolve (Expr, R_Type);
+
+ -- The expansion of the expression may have rewritten the return
+ -- statement itself, e.g. when it is a conditional expression.
+
+ if Nkind (N) /= N_Simple_Return_Statement then
+ return;
+ end if;
+
Check_Limited_Return (N, Expr, R_Type);
Check_Return_Construct_Accessibility (N, Stm_Entity);
@@ -952,9 +960,7 @@ package body Sem_Ch6 is
-- Defend against previous errors
- if Nkind (Expr) = N_Empty
- or else No (Etype (Expr))
- then
+ if Nkind (Expr) = N_Empty or else No (Etype (Expr)) then
return;
end if;