]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix spurious error on imported generic function with precondition
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 10 Apr 2023 08:15:59 +0000 (10:15 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 27 Sep 2023 08:16:27 +0000 (10:16 +0200)
It occurs during the instantiation because the compiler forgets the context
of the generic declaration.

gcc/ada/

* freeze.adb (Wrap_Imported_Subprogram): Use Copy_Subprogram_Spec in
both cases to copy the spec of the subprogram.

gcc/ada/freeze.adb

index df3b5ec944e9d01999bfb0fd62a683a597844e92..c26c59e24ca9d58816e1229555bf0dd00ad48404 100644 (file)
@@ -6066,12 +6066,6 @@ package body Freeze is
          then
             --  Here we do the wrap
 
-            --  Note on calls to Copy_Separate_Tree. The trees we are copying
-            --  here are fully analyzed, but we definitely want fully syntactic
-            --  unanalyzed trees in the body we construct, so that the analysis
-            --  generates the right visibility, and that is exactly what the
-            --  calls to Copy_Separate_Tree give us.
-
             Prag := Copy_Import_Pragma;
 
             --  Fix up spec so it is no longer imported and has convention Ada
@@ -6130,7 +6124,7 @@ package body Freeze is
                 Specification              => Copy_Subprogram_Spec (Spec),
                 Declarations               => New_List (
                   Make_Subprogram_Declaration (Loc,
-                    Specification => Copy_Separate_Tree (Spec)),
+                    Specification => Copy_Subprogram_Spec (Spec)),
                   Prag),
                 Handled_Statement_Sequence =>
                   Make_Handled_Sequence_Of_Statements (Loc,