]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Formal function default given by expression rejected with -gnatX
authorGary Dismukes <dismukes@adacore.com>
Tue, 20 Jan 2026 22:35:50 +0000 (22:35 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 25 May 2026 08:28:13 +0000 (10:28 +0200)
The compiler should be allowing formal functions to be defaulted by
an expression when the core extensions are enabled, but it was
requiring all extensions to be enabled.

gcc/ada/ChangeLog:

* par-ch12.adb (P_Formal_Subprogram_Declaration): Pass True for
the Is_Core_Extension parameter on call to Error_Msg_GNAT_Extension.

gcc/ada/par-ch12.adb

index ebd049ca7345370157f37dec07578007acf6a97d..3b9cb3c0355d4990f4f311d0369c10e9c91ae7d4 100644 (file)
@@ -1207,7 +1207,8 @@ package body Ch12 is
 
          elsif Token = Tok_Left_Paren then
             Error_Msg_GNAT_Extension
-              ("expression default for formal subprograms", Token_Ptr);
+              ("expression default for formal subprograms", Token_Ptr,
+               Is_Core_Extension => True);
 
             if Nkind (Spec_Node) = N_Function_Specification then
                Scan;  --  past "("