+2009-07-07 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Analyze_Conditional_Expression): handle properly
+ overloaded expressions in a conditional expressions.
+
+ * sem_res.adb (Resolve): Handle properly overloaded conditional
+ expressions.
+
2009-07-07 Robert Dewar <dewar@adacore.com>
* scng.adb: Minor reformattting
Analyze_Expression (Else_Expr);
end if;
- Set_Etype (N, Etype (Then_Expr));
+ if not Is_Overloaded (Then_Expr) then
+ Set_Etype (N, Etype (Then_Expr));
+ else
+ declare
+ I : Interp_Index;
+ It : Interp;
+
+ begin
+ Set_Etype (N, Any_Type);
+ Get_First_Interp (Then_Expr, I, It);
+ while Present (It.Nam) loop
+ if Has_Compatible_Type (Else_Expr, It.Typ) then
+ Add_One_Interp (N, It.Typ, It.Typ);
+ end if;
+
+ Get_Next_Interp (I, It);
+ end loop;
+ end;
+ end if;
end Analyze_Conditional_Expression;
-------------------------
elsif Nkind (N) = N_Character_Literal then
Set_Etype (N, Expr_Type);
+ elsif Nkind (N) = N_Conditional_Expression then
+ Set_Etype (N, Expr_Type);
+
-- For an explicit dereference, attribute reference, range,
-- short-circuit form (which is not an operator node), or call
-- with a name that is an explicit dereference, there is