GNAT used to reject such code with a spurious error about the aspect not
being attached to the initial declaration. Now fixed. The workaround is
to declare a library-level spec for the subprogram, to which the aspects
are attached.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * sem_ch10.adb (Analyze_Compilation_Unit): Move aspects from
        body to the newly created spec.
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -828,6 +828,7 @@ package body Sem_Ch10 is
                      --  of the child unit does not act as spec any longer.
 
                      Set_Acts_As_Spec (N, False);
+                     Move_Aspects (From => Unit_Node, To => Unit (Lib_Unit));
                      Set_Is_Child_Unit (Defining_Entity (Unit_Node));
                      Set_Debug_Info_Needed (Defining_Entity (Unit (Lib_Unit)));
                      Set_Comes_From_Source_Default (SCS);


Reply via email to