Index: sem_ch12.adb =================================================================== --- sem_ch12.adb (revision 178398) +++ sem_ch12.adb (working copy) @@ -4430,8 +4430,6 @@ -- for the compilation, we generate the instance body even if it is -- not within the main unit. - -- Any other pragmas might also be inherited ??? - if Is_Intrinsic_Subprogram (Gen_Unit) then Set_Is_Intrinsic_Subprogram (Anon_Id); Set_Is_Intrinsic_Subprogram (Act_Decl_Id); @@ -4441,6 +4439,17 @@ end if; end if; + -- Inherit convention from generic unit. Intrinsic convention, as for + -- an instance of unchecked conversion, is not inherited because an + -- explicit Ada instance has been created. + + if Has_Convention_Pragma (Gen_Unit) + and then Convention (Gen_Unit) /= Convention_Intrinsic + then + Set_Convention (Act_Decl_Id, Convention (Gen_Unit)); + Set_Is_Exported (Act_Decl_Id, Is_Exported (Gen_Unit)); + end if; + Generate_Definition (Act_Decl_Id); Set_Contract (Anon_Id, Make_Contract (Sloc (Anon_Id))); -- ??? needed? Set_Contract (Act_Decl_Id, Make_Contract (Sloc (Act_Decl_Id))); @@ -4479,8 +4488,6 @@ Check_Hidden_Child_Unit (N, Gen_Unit, Act_Decl_Id); - -- Subject to change, pending on if other pragmas are inherited ??? - Validate_Categorization_Dependency (N, Act_Decl_Id); if not Is_Intrinsic_Subprogram (Act_Decl_Id) then