aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-27 11:57:00 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-27 11:57:00 +0200
commitb63d61f7d1256c255013af6ea4b0f64bdd6d7340 (patch)
treee3ecd4e087cb6d587db234fbb131aea9674974c6 /gcc/ada/sem_ch4.adb
parentbb9e2aa27576a5dc46bc679949309de4c1600132 (diff)
downloadgcc-b63d61f7d1256c255013af6ea4b0f64bdd6d7340.zip
gcc-b63d61f7d1256c255013af6ea4b0f64bdd6d7340.tar.gz
gcc-b63d61f7d1256c255013af6ea4b0f64bdd6d7340.tar.bz2
[multiple changes]
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com> * a-cofuse.adb, a-cfdlli.adb, a-cofuse.ads, a-cfdlli.ads, a-cofuve.adb, a-cofuve.ads, a-cofuma.adb, a-cofuma.ads, sem_eval.adb, a-cofuba.adb: Minor reformatting. 2017-04-27 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Call): If the return type of a function is incomplete in an context in which the full view is available, replace the type of the call by the full view, to prevent spurious type errors. * exp_disp.adb (Check_Premature_Freezing): Disable check on an abstract subprogram so that compiler does not reject a parameter of a primitive operation of a tagged type being frozen, when the untagged type of that parameter cannot be frozen. 2017-04-27 Bob Duff <duff@adacore.com> * sem_attr.adb (Compute_Type_Key): Don't walk representation items for irrelevant types, which could be in a different source file. 2017-04-27 Steve Baird <baird@adacore.com> * exp_attr.adb (Expand_N_Attribute_Reference): Don't expand Image, Wide_Image, Wide_Wide_Image attributes for CodePeer. From-SVN: r247305
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 4e54edb..8da266a 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -1463,6 +1463,25 @@ package body Sem_Ch4 is
-- actuals.
Check_Function_Writable_Actuals (N);
+
+ -- The return type of the function may be incomplete. This can be
+ -- the case if the type is a generic formal, or a limited view. It
+ -- can also happen when the function declaration appears before the
+ -- full view of the type (which is legal in Ada 2012) and the call
+ -- appears in a different unit, in which case the incomplete view
+ -- must be replaced with the full view to prevent subsequent type
+ -- errors.
+
+ if Is_Incomplete_Type (Etype (N))
+ and then Present (Full_View (Etype (N)))
+ then
+ if Is_Entity_Name (Nam) then
+ Set_Etype (Nam, Full_View (Etype (N)));
+ Set_Etype (Entity (Nam), Full_View (Etype (N)));
+ end if;
+
+ Set_Etype (N, Full_View (Etype (N)));
+ end if;
end if;
end Analyze_Call;