Compiler rejects an expression function whose signature includes an
access parameter with a null_exclusion indicator.

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

gcc/ada/

        * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not perform
        conformance check when the subprogram body has been created for
        an expression function that is not a completion of a previous
        specification, because the profile of the constructed body is
        copied from the expression function itself.
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4585,6 +4585,17 @@ package body Sem_Ch6 is
             then
                Conformant := True;
 
+            --  Finally, a body generated for an expression function copies
+            --  the profile of the function and no check is needed either.
+            --  If the body is the completion of a previous function
+            --  declared elsewhere, the conformance check is required.
+
+            elsif Nkind (N) = N_Subprogram_Body
+              and then Was_Expression_Function (N)
+              and then Sloc (Spec_Id) = Sloc (Body_Id)
+            then
+               Conformant := True;
+
             else
                Check_Conformance
                  (Body_Id, Spec_Id,


Reply via email to