aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-04-05 23:53:18 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-05-29 10:23:21 +0200
commit6fe8909606f79db1fb2107336544b058eaeb6381 (patch)
treee45f55d72516e43e52010531fc692623a96408c7 /gcc/ada/sem_res.adb
parent5c934733eb116cf9742798bd571f147f0eb7086a (diff)
downloadgcc-6fe8909606f79db1fb2107336544b058eaeb6381.zip
gcc-6fe8909606f79db1fb2107336544b058eaeb6381.tar.gz
gcc-6fe8909606f79db1fb2107336544b058eaeb6381.tar.bz2
ada: Fix small fallout of previous change
It may lead to an infinite recursion if no interpretation exists. gcc/ada/ * sem_res.adb (Try_User_Defined_Literal): Restrict previous change to non-leaf nodes.
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 17b74ea..1d4b9ac 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -13333,15 +13333,17 @@ package body Sem_Res is
-- Both operands must have the same type as the context
-- (ignoring for now fixed-point and exponentiation ops).
- if Covers (Typ, Etype (Right_Opnd (N)))
- or else Has_Applicable_User_Defined_Literal (Right_Opnd (N), Typ)
+ if Has_Applicable_User_Defined_Literal (Right_Opnd (N), Typ)
+ or else (Nkind (Left_Opnd (N)) in N_Op
+ and then Covers (Typ, Etype (Right_Opnd (N))))
then
Resolve (Left_Opnd (N), Typ);
Analyze_And_Resolve (N, Typ);
return True;
- elsif Covers (Typ, Etype (Left_Opnd (N)))
- or else Has_Applicable_User_Defined_Literal (Left_Opnd (N), Typ)
+ elsif Has_Applicable_User_Defined_Literal (Left_Opnd (N), Typ)
+ or else (Nkind (Right_Opnd (N)) in N_Op
+ and then Covers (Typ, Etype (Left_Opnd (N))))
then
Resolve (Right_Opnd (N), Typ);
Analyze_And_Resolve (N, Typ);