public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1588] [Ada] Error in instance on incomplete actual passed to formal incomplete type
@ 2021-06-17 14:34 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-17 14:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:83a5b1df3da2d6c50efabdbf4767a32e80f0cab1
commit r12-1588-g83a5b1df3da2d6c50efabdbf4767a32e80f0cab1
Author: Gary Dismukes <dismukes@adacore.com>
Date: Wed Mar 10 18:35:58 2021 -0500
[Ada] Error in instance on incomplete actual passed to formal incomplete type
gcc/ada/
* sem_ch12.adb (Instantiate_Type): If the actual type for an
incomplete formal type is also incomplete, but has a Full_View,
use the Full_View of the actual type rather than the incomplete
view.
Diff:
---
gcc/ada/sem_ch12.adb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 2cd46895d28..06947e22878 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -14022,9 +14022,12 @@ package body Sem_Ch12 is
and then Ekind (Root_Type (Act_T)) = E_Incomplete_Type)
then
-- If the formal is an incomplete type, the actual can be
- -- incomplete as well.
+ -- incomplete as well, but if an actual incomplete type has
+ -- a full view, then we'll retrieve that.
- if Ekind (A_Gen_T) = E_Incomplete_Type then
+ if Ekind (A_Gen_T) = E_Incomplete_Type
+ and then not Present (Full_View (Act_T))
+ then
null;
elsif Is_Class_Wide_Type (Act_T)
@@ -14032,6 +14035,7 @@ package body Sem_Ch12 is
then
Error_Msg_N ("premature use of incomplete type", Actual);
Abandon_Instantiation (Actual);
+
else
Act_T := Full_View (Act_T);
Set_Entity (Actual, Act_T);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-17 14:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 14:34 [gcc r12-1588] [Ada] Error in instance on incomplete actual passed to formal incomplete type Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).