diff options
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 017318c8027..cb54be10215 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -17029,18 +17029,7 @@ package body Sem_Ch3 is when N_Attribute_Reference => return Attribute_Name (Original_Node (Exp)) = Name_Input; - -- For a conditional expression, all dependent expressions must be - -- legal constructs. - - when N_Conditional_Expression => - declare - Then_Expr : constant Node_Id := - Next (First (Expressions (Original_Node (Exp)))); - Else_Expr : constant Node_Id := Next (Then_Expr); - begin - return OK_For_Limited_Init_In_05 (Typ, Then_Expr) - and then OK_For_Limited_Init_In_05 (Typ, Else_Expr); - end; + -- For a case expression, all dependent expressions must be legal when N_Case_Expression => declare @@ -17059,6 +17048,19 @@ package body Sem_Ch3 is return True; end; + -- For an if expression, all dependent expressions must be legal + + when N_If_Expression => + declare + Then_Expr : constant Node_Id := + Next (First (Expressions (Original_Node (Exp)))); + Else_Expr : constant Node_Id := Next (Then_Expr); + begin + return OK_For_Limited_Init_In_05 (Typ, Then_Expr) + and then + OK_For_Limited_Init_In_05 (Typ, Else_Expr); + end; + when others => return False; end case; |