@@ -2433,6 +2433,20 @@ package body Sem_Ch10 is
Install_Elaboration_Model (Par_Unit);
+ -- The syntax rules require a proper body for a subprogram subunit
+
+ if Nkind (Proper_Body (Sinfo.Unit (N))) = N_Subprogram_Declaration then
+ if Null_Present (Specification (Proper_Body (Sinfo.Unit (N)))) then
+ Error_Msg_N
+ ("null procedure not allowed as subunit",
+ Proper_Body (Unit (N)));
+ else
+ Error_Msg_N
+ ("subprogram declaration not allowed as subunit",
+ Defining_Unit_Name (Specification (Proper_Body (Unit (N)))));
+ end if;
+ end if;
+
Analyze (Proper_Body (Unit (N)));
Remove_Context (N);