Before this patch, Build_Static_Dispatch_Tables was called on generic
package bodies. While this has not been proved to cause any actual bug,
it was clearly inappropriate and also useless, so this patch removes
those calls.
gcc/ada/ChangeLog:
* sem_ch10.adb (Analyze_Compilation_Unit): Check for generic bodies.
* exp_disp.adb (Build_Dispatch_Tables): Likewise.
if Nkind (D) = N_Package_Declaration then
Build_Package_Dispatch_Tables (D);
- elsif Nkind (D) = N_Package_Body then
+ elsif Nkind (D) = N_Package_Body
+ and then Ekind (Corresponding_Spec (D)) /= E_Generic_Package
+ then
Build_Dispatch_Tables (Declarations (D));
elsif Nkind (D) = N_Package_Body_Stub
if Expander_Active and then Tagged_Type_Expansion then
case Nkind (Unit_Node) is
- when N_Package_Declaration | N_Package_Body =>
+ when N_Package_Declaration =>
Build_Static_Dispatch_Tables (Unit_Node);
+ when N_Package_Body =>
+ if Ekind (Corresponding_Spec (Unit_Node)) /= E_Generic_Package
+ then
+ Build_Static_Dispatch_Tables (Unit_Node);
+ end if;
+
when N_Package_Instantiation =>
Build_Static_Dispatch_Tables (Instance_Spec (Unit_Node));