summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-03 15:41:36 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-03 15:41:36 +0000
commitdbd6061a5dbd835c3113512f6b5da8709101c460 (patch)
treec686442352752fe7e5ecb5206614ab5bfcb175de /gcc/ada/sem_res.adb
parent072569952a3c23ddab900d14aedf6f7479739cf6 (diff)
downloadgcc-dbd6061a5dbd835c3113512f6b5da8709101c460.tar.gz
* sem_ch4.adb (Has_Fixed_Op): New predicate in Check_Arithmetic_Pair,
to determine whether one of the operands is a fixed-point type for which a user-defined multiplication or division operation might be defined. * sem_res.adb (Valid_Conversion): The legality rules for conversions of access types are symmetric in Ada 2005: either designated type can be unconstrained. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92849 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 9e384e98023..b89f82b0097 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -7112,17 +7112,25 @@ package body Sem_Res is
N, Base_Type (Opnd));
return False;
- elsif not Subtypes_Statically_Match (Target, Opnd)
- and then (not Has_Discriminants (Target)
- or else Is_Constrained (Target))
+ -- Ada 2005 AI-384: legality rule is symmetric in both
+ -- designated types. The conversion is legal (with possible
+ -- constraint check) if either designated type is
+ -- unconstrained.
+
+ elsif Subtypes_Statically_Match (Target, Opnd)
+ or else
+ (Has_Discriminants (Target)
+ and then
+ (not Is_Constrained (Opnd)
+ or else not Is_Constrained (Target)))
then
+ return True;
+
+ else
Error_Msg_NE
("target designated subtype not compatible with }",
N, Opnd);
return False;
-
- else
- return True;
end if;
end if;
end;