]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix internal error on function call in class-wide precondition
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 27 Sep 2024 10:19:14 +0000 (12:19 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 25 Oct 2024 09:09:01 +0000 (11:09 +0200)
This occurs when the call is to a function that is declared in a package
that is nested in the scope where the type declaration is located.

gcc/ada/ChangeLog:

* freeze.adb (Freeze_Expression.In_Expanded_Body): Also return True
for the body of a helper/wrapper built for class-wide preconditions.

gcc/ada/freeze.adb

index 882c026455ecc0fe1df35fb57173833c160dec99..326b39b0545874aa5a37e52430ab464fe7ba84f0 100644 (file)
@@ -8438,6 +8438,14 @@ package body Freeze is
          then
             return True;
 
+         --  This is the body of a helper/wrapper built for CW preconditions
+
+         elsif Present (Corresponding_Spec (P))
+           and then
+             Present (Class_Preconditions_Subprogram (Corresponding_Spec (P)))
+         then
+            return True;
+
          else
             Id := Defining_Unit_Name (Specification (P));