aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_eval.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 09:08:23 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 09:08:23 +0200
commitf0d103851aea8fdb96bde64a44b8bac395ef6384 (patch)
tree688882bcccbcc9c373ed6773350213fd15bfa338 /gcc/ada/sem_eval.adb
parentd7567964ea0f6ff865f8488a06bc5dff75a0973e (diff)
downloadgcc-f0d103851aea8fdb96bde64a44b8bac395ef6384.zip
gcc-f0d103851aea8fdb96bde64a44b8bac395ef6384.tar.gz
gcc-f0d103851aea8fdb96bde64a44b8bac395ef6384.tar.bz2
[multiple changes]
2010-06-22 Gary Dismukes <dismukes@adacore.com> * sem_ch3.adb (Build_Discriminal): Set default scopes for newly created discriminals to the current scope. * sem_util.adb (Find_Body_Discriminal): Remove setting of discriminal's scope, which could overwrite a different already set value. 2010-06-22 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Valid_Conversion): If expression is a predefined operator, use sloc of type of interpretation to improve error message when operand is of some derived type. * sem_eval.adb (Is_Mixed_Mode_Operand): New function, use it. 2010-06-22 Emmanuel Briot <briot@adacore.com> * g-expect-vms.adb (Expect_Internal): No longer raises an exception, so that it can set out parameters as well. When a process has died, reset its Input_Fd to Invalid_Fd, so that when using multiple processes we can find out which process has died. From-SVN: r161135
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r--gcc/ada/sem_eval.adb32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index 1d9e0f6..fb17144 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -4799,6 +4799,24 @@ package body Sem_Eval is
Typ1 : Entity_Id := Empty;
Priv_E : Entity_Id;
+ function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean;
+ -- Check whether one operand is a mixed-mode operation that requires
+ -- the presence of a fixed-point type. Given that all operands are
+ -- universal and have been constant-folded, retrieve the original
+ -- function call.
+
+ ---------------------------
+ -- Is_Mixed_Mode_Operand --
+ ---------------------------
+
+ function Is_Mixed_Mode_Operand (Op : Node_Id) return Boolean is
+ begin
+ return Nkind (Original_Node (Op)) = N_Function_Call
+ and then Present (Next_Actual (First_Actual (Original_Node (Op))))
+ and then Etype (First_Actual (Original_Node (Op))) /=
+ Etype (Next_Actual (First_Actual (Original_Node (Op))));
+ end Is_Mixed_Mode_Operand;
+
begin
if Nkind (Call) /= N_Function_Call
or else Nkind (Name (Call)) /= N_Expanded_Name
@@ -4845,6 +4863,20 @@ package body Sem_Eval is
if No (Typ1) then
Typ1 := E;
+ -- Before emitting an error, check for the presence of a
+ -- mixed-mode operation that specifies a fixed point type.
+
+ elsif Is_Relational
+ and then
+ (Is_Mixed_Mode_Operand (Left_Opnd (N))
+ or else Is_Mixed_Mode_Operand (Right_Opnd (N)))
+ and then Is_Fixed_Point_Type (E) /= Is_Fixed_Point_Type (Typ1)
+
+ then
+ if Is_Fixed_Point_Type (E) then
+ Typ1 := E;
+ end if;
+
else
-- More than one type of the proper class declared in P