aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-05-09 08:56:27 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-06-01 08:43:19 +0000
commit4e8310b33c37d1eaaa4ffd08aca404a787252cf5 (patch)
treea22b706c4c8350c6f8962a9cd87ef66daaef7eed /gcc/ada/sem_disp.adb
parentce0bbf28fb11b75ebc7d0140ccc38857c03303d9 (diff)
downloadgcc-4e8310b33c37d1eaaa4ffd08aca404a787252cf5.zip
gcc-4e8310b33c37d1eaaa4ffd08aca404a787252cf5.tar.gz
gcc-4e8310b33c37d1eaaa4ffd08aca404a787252cf5.tar.bz2
[Ada] Do not freeze subprogram body without spec too early
This fixes a small oddity whereby a subprogram body declared without a spec would be frozen before its entity is fully processed as an overloaded name. Now the latter step computes useful information, for example whether the body is a (late) primitive of a tagged type, which can be required during the freezing process. The change also adjusts Check_Dispatching_Operation accordingly. No functional changes. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): For the case where there is no previous declaration, freeze the body entity only after it has been processed as a new overloaded name. Use Was_Expression_Function to recognize expression functions. * sem_disp.adb (Check_Dispatching_Operation): Do not require a body which is the last primitive to be frozen here.
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 79af10a..d589391 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -1516,11 +1516,10 @@ package body Sem_Disp is
("\spec should appear immediately after the type!",
Subp);
- elsif Is_Frozen (Subp) then
+ else
-- The subprogram body declares a primitive operation.
- -- If the subprogram is already frozen, we must update
- -- its dispatching information explicitly here. The
+ -- We must update its dispatching information here. The
-- information is taken from the overridden subprogram.
-- We must also generate a cross-reference entry because
-- references to other primitives were already created