]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix check for looking for user defined literals
authorEd Schonberg <schonberg@adacore.com>
Tue, 14 Dec 2021 14:44:16 +0000 (15:44 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 9 May 2022 09:27:33 +0000 (09:27 +0000)
Recall that Has_Possible_Literal_Aspects only comes in if a given node
does not have any visible interpretation. If one operand is a literal we
assume that there may be a user-defined literal defined for some type to
be determined during the downward pass of resolution, but that depends
on the existence of some user-defined function or operator that can take
that literal as an actual. If analysis did not find such, the call is
illegal. I think that the following must be added to Operator_Check to
recover the proper error.

Note that this breaks current partial implementation of user-defined
literals.

gcc/ada/

* sem_ch4.adb (Operator_Check): Fix condition.

gcc/ada/sem_ch4.adb

index 68839b31345493ad9ac1719e701272077d5bc802..915a7b48eca6dc745bb2c06e8f5954954a9f7a0b 100644 (file)
@@ -7260,7 +7260,9 @@ package body Sem_Ch4 is
             then
                return;
 
-            elsif Has_Possible_Literal_Aspects (N) then
+            elsif Present (Entity (N))
+              and then Has_Possible_Literal_Aspects (N)
+            then
                return;
 
             --  If we have a logical operator, one of whose operands is