summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 7e64d98cd67..fb20b1a6554 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -1156,11 +1156,14 @@ package body Sem_Disp is
-- Ada 2005 (AI-251): In case of late overriding of a primitive
-- that covers abstract interface subprograms we must register it
-- in all the secondary dispatch tables associated with abstract
- -- interfaces. We do this now only if not building static tables.
- -- Otherwise the patch code is emitted after those tables are
- -- built, to prevent access_before_elaboration in gigi.
-
- if Body_Is_Last_Primitive then
+ -- interfaces. We do this now only if not building static tables,
+ -- nor when the expander is inactive (we avoid trying to register
+ -- primitives in semantics-only mode, since the type may not have
+ -- an associated dispatch table). Otherwise the patch code is
+ -- emitted after those tables are built, to prevent access before
+ -- elaboration in gigi.
+
+ if Body_Is_Last_Primitive and then Full_Expander_Active then
declare
Subp_Body : constant Node_Id := Unit_Declaration_Node (Subp);
Elmt : Elmt_Id;