aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_eval.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r--gcc/ada/sem_eval.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index 0d135cf..6e56e1d 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -2682,9 +2682,12 @@ package body Sem_Eval is
-- If the literal appears in a non-expression context, then it is
-- certainly appearing in a non-static context, so check it. This is
-- actually a redundant check, since Check_Non_Static_Context would
- -- check it, but it seems worth while avoiding the call.
+ -- check it, but it seems worth while to optimize out the call.
- if Nkind (Parent (N)) not in N_Subexpr
+ -- An exception is made for a literal in an if or case expression
+
+ if (Nkind_In (Parent (N), N_If_Expression, N_Case_Expression_Alternative)
+ or else Nkind (Parent (N)) not in N_Subexpr)
and then not In_Any_Integer_Context
then
Check_Non_Static_Context (N);