This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] ada/16087: Accept statically matching constraint in full view
- From: Arnaud Charlet <charlet at adacore dot com>
- To: Samuel Tardieu <sam at rfc1149 dot net>
- Cc: gcc-patches at gcc dot gnu dot org, Ed Schonberg <schonberg at adacore dot com>
- Date: Mon, 12 May 2008 22:13:48 +0200
- Subject: Re: [PATCH] ada/16087: Accept statically matching constraint in full view
- References: <20080507141950.D5A9E8045@dawn.rfc1149.net>
> Bootstrapped and regtested on i686-pc-linux-gnu. Ok for trunk?
> * sem_ch3.adb (Build_Derived_Record_Type): Accept statically matching
> constraint expressions.
> * gnat.dg/specs/statically_matching.ads: New.
OK with the following minor changes and comment updates (from ed):
@@ -6275,8 +6275,8 @@
and then Has_Private_Declaration (Derived_Type)
and then Present (Discriminant_Constraint (Derived_Type))
- -- Verify that constraints of the full view conform to those
- -- given in partial view.
+ -- Verify that constraints of the full view statically match
+ -- those given in the partial view.
C1, C2 : Elmt_Id;
@@ -6285,9 +6285,18 @@
C1 := First_Elmt (New_Discrs);
C2 := First_Elmt (Discriminant_Constraint (Derived_Type));
while Present (C1) and then Present (C2) loop
- if not
- Fully_Conformant_Expressions (Node (C1), Node (C2))
+ if Fully_Conformant_Expressions (Node (C1), Node (C2))
+ or else
+ (Is_OK_Static_Expression (Node (C1))
+ and then
+ Is_OK_Static_Expression (Node (C2))
+ and then
+ Expr_Value (Node (C1)) = Expr_Value (Node (C2)))
"constraint not conformant to previous declaration",