This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] fix bug in conformance checking


Tested on i686-linux, committed on mainline.

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. The previous change in this area
was incomplete because it only accounted for the case where the first type
was a full view and second type was private, and this fix extends it to
cover the opposite order. In this case the problem arose with a conversion
to an access-to-subprogram type one of whose parameters was of the generic
formal type.
The test case must compile without errors:
$ gcc -c p-i.ads
--
package body G is procedure X (P : PT) is begin null; end; end; 
generic type T (<>) is private; 
package G is 
   type PT is access procedure (P : T); 
   procedure X (P : PT); 
end; 
package body H is 
   procedure X (P : PT) is begin GI.X (GI.PT (P)); end; 
end; 
with G; 
generic type T is private; 
package H is 
   pragma Elaborate_Body; 
   type PT is access procedure (P : T); 
private 
   package GI is new G (T); 
end; 
with H; package P.I is new H (A); 
package P is 
   type A is private; 
private 
   type A (D : Boolean := False) is null record; 
end; 

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.

Attachment: difs.19
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]