diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-04-05 20:43:54 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2023-09-27 10:16:26 +0200 |
commit | d051e7e75d3ad36ec62b9f53c856a7fb6dbe4f28 (patch) | |
tree | 56474b19b943503841ddbf975a1c4e5dd1773639 /gcc | |
parent | 34a2d742bfbec548058ed3a25d3e35ec180eb7c4 (diff) | |
download | gcc-d051e7e75d3ad36ec62b9f53c856a7fb6dbe4f28.zip gcc-d051e7e75d3ad36ec62b9f53c856a7fb6dbe4f28.tar.gz gcc-d051e7e75d3ad36ec62b9f53c856a7fb6dbe4f28.tar.bz2 |
ada: Fix remaining failures in Roman Numbers test
The test is inspired from the example of user-defined literals given in the
Ada 2022 RM. Mixed Arabic numbers/Roman numbers computations are rejected
because the second resolution pass would try to resolve Arabic numbers only
as user-defined literals.
gcc/ada/
* sem_res.adb (Try_User_Defined_Literal): For arithmetic operators,
also accept operands whose type is covered by the resolution type.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_res.adb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b819deb..615d9d8 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -13219,12 +13219,16 @@ package body Sem_Res is -- Both operands must have the same type as the context -- (ignoring for now fixed-point and exponentiation ops). - if Has_Applicable_User_Defined_Literal (Right_Opnd (N), Typ) then + if Covers (Typ, Etype (Right_Opnd (N))) + or else Has_Applicable_User_Defined_Literal (Right_Opnd (N), Typ) + then Resolve (Left_Opnd (N), Typ); Analyze_And_Resolve (N, Typ); return True; - elsif Has_Applicable_User_Defined_Literal (Left_Opnd (N), Typ) then + elsif Covers (Typ, Etype (Left_Opnd (N))) + or else Has_Applicable_User_Defined_Literal (Left_Opnd (N), Typ) + then Resolve (Right_Opnd (N), Typ); Analyze_And_Resolve (N, Typ); return True; |