aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2005-07-04 15:29:58 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2005-07-04 15:29:58 +0200
commitc2bf339e6b769c71653b255148ae8386b19c229c (patch)
tree502c62296b3bdfd81a7e5b4fcec232f330d3f6f0 /gcc
parent9dcb52e145b7b6eb52c71d14f797e82fae9c32cd (diff)
downloadgcc-c2bf339e6b769c71653b255148ae8386b19c229c.zip
gcc-c2bf339e6b769c71653b255148ae8386b19c229c.tar.gz
gcc-c2bf339e6b769c71653b255148ae8386b19c229c.tar.bz2
sem_eval.adb (Subtypes_Statically_Match): Use the discriminant constraint of full view of a private view T1 if present...
2005-07-04 Gary Dismukes <dismukes@adacore.com> * sem_eval.adb (Subtypes_Statically_Match): Use the discriminant constraint of full view of a private view T1 if present, when T2 is a discriminated full view. From-SVN: r101589
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_eval.adb29
1 files changed, 22 insertions, 7 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index caa9153..396027d 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -3927,15 +3927,30 @@ package body Sem_Eval is
elsif Has_Discriminants (T1) or else Has_Discriminants (T2) then
- -- We really need comments here ???
+ -- Because of view exchanges in multiple instantiations, conformance
+ -- checking might try to match a partial view of a type with no
+ -- discriminants with a full view that has defaulted discriminants.
+ -- In such a case, use the discriminant constraint of the full view,
+ -- which must exist because we know that the two subtypes have the
+ -- same base type.
if Has_Discriminants (T1) /= Has_Discriminants (T2) then
- if In_Instance
- and then Is_Private_Type (T2)
- and then Present (Full_View (T2))
- and then Has_Discriminants (Full_View (T2))
- then
- return Subtypes_Statically_Match (T1, Full_View (T2));
+ if In_Instance then
+ if Is_Private_Type (T2)
+ and then Present (Full_View (T2))
+ and then Has_Discriminants (Full_View (T2))
+ then
+ return Subtypes_Statically_Match (T1, Full_View (T2));
+
+ elsif Is_Private_Type (T1)
+ and then Present (Full_View (T1))
+ and then Has_Discriminants (Full_View (T1))
+ then
+ return Subtypes_Statically_Match (Full_View (T1), T2);
+
+ else
+ return False;
+ end if;
else
return False;
end if;