sem_ch4.adb (Find_Boolean_Types): If one of the operands is an aggregate...
authorEd Schonberg <schonberg@adacore.com>
Fri, 17 Feb 2006 16:05:24 +0000 (17:05 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 17 Feb 2006 16:05:24 +0000 (17:05 +0100)
2006-02-17  Ed Schonberg  <schonberg@adacore.com>

* sem_ch4.adb (Find_Boolean_Types): If one of the operands is an
aggregate, check the interpretations of the other operand to find one
that may be a boolean array.
(Analyze_Selected_Component): Fix flow-of-control typo in case where
the prefix is a private extension.

From-SVN: r111182

gcc/ada/sem_ch4.adb

index 06669fb4a17628d3814d4b136f27081e589d0f44..ac5f38da2ced902120c30b56b99c7b021cb51924 100644 (file)
@@ -2953,7 +2953,7 @@ package body Sem_Ch4 is
                      Set_Entity_With_Style_Check (Sel, Comp);
                      Set_Etype (Sel, Etype (Comp));
                      Set_Etype (N,   Etype (Comp));
-                     exit;
+                     return;
                   end if;
 
                   Next_Component (Comp);
@@ -3841,6 +3841,31 @@ package body Sem_Ch4 is
                end loop;
             end if;
 
+         --  If operands are aggregates, we must assume that they may be
+         --  boolean arrays, and leave disambiguation for the second pass.
+         --  If only one is an aggregate, verify that the other one has an
+         --  interpretation as a boolean array
+
+         elsif Nkind (L) = N_Aggregate then
+            if Nkind (R) = N_Aggregate then
+               Add_One_Interp (N, Op_Id, Etype (L));
+
+            elsif not Is_Overloaded (R) then
+               if Valid_Boolean_Arg (Etype (R)) then
+                  Add_One_Interp (N, Op_Id, Etype (R));
+               end if;
+
+            else
+               Get_First_Interp (R, Index, It);
+               while Present (It.Typ) loop
+                  if Valid_Boolean_Arg (It.Typ) then
+                     Add_One_Interp (N, Op_Id, It.Typ);
+                  end if;
+
+                  Get_Next_Interp (Index, It);
+               end loop;
+            end if;
+
          elsif Valid_Boolean_Arg (Etype (L))
            and then Has_Compatible_Type (R, Etype (L))
          then