aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2009-07-07 10:40:14 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-07-07 12:40:14 +0200
commite0ba1bfd6445f979c50a9faba4ac91f90722ef4e (patch)
tree638d1cb3d47d633fb172439a6c9ce1cb9bc73111
parentb46be8a2b70f416b8c12697885b5c7a315a3aeba (diff)
downloadgcc-e0ba1bfd6445f979c50a9faba4ac91f90722ef4e.zip
gcc-e0ba1bfd6445f979c50a9faba4ac91f90722ef4e.tar.gz
gcc-e0ba1bfd6445f979c50a9faba4ac91f90722ef4e.tar.bz2
sem_ch4.adb (Analyze_Conditional_Expression): handle properly overloaded expressions in a conditional expressions.
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. From-SVN: r149317
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/sem_ch4.adb20
-rw-r--r--gcc/ada/sem_res.adb3
3 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 455f0a5..a923a92 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 6303dd1..98cbde3 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -1250,7 +1250,25 @@ package body Sem_Ch4 is
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;
-------------------------
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 95f3c9b..ba06ee8 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -2146,6 +2146,9 @@ package body Sem_Res is
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