aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-09-05 16:12:04 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-09-05 16:12:04 +0200
commit5dcab3ca08db53487bf2a2dbdd380009ea1bc927 (patch)
tree10a248965adffdb9d24321bdf442196138ddcebf /gcc/ada/sem_disp.adb
parent8da1a312964053d22469519475e61573d8ebf2a5 (diff)
downloadgcc-5dcab3ca08db53487bf2a2dbdd380009ea1bc927.zip
gcc-5dcab3ca08db53487bf2a2dbdd380009ea1bc927.tar.gz
gcc-5dcab3ca08db53487bf2a2dbdd380009ea1bc927.tar.bz2
[multiple changes]
2011-09-05 Ed Schonberg <schonberg@adacore.com> * sem_disp.adb (Find_Controlling_Arg): Add checks for interface type conversions, that are expanded into dereferences. 2011-09-05 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Examine the parameter and return profile of a subprogram and swap any incomplete types coming from a limited context with their corresponding non-limited views. (Exchange_Limited_Views): New routine. 2011-09-05 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Prepare_Private_Subtype_Completion): Set parent of internal entity to the subtype declaration, so that when entities are subsequently exchanged in a package body, the tree remains properly formatted for ASIS. From-SVN: r178548
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index fb20b1a..2d80676 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -1616,6 +1616,32 @@ package body Sem_Disp is
then
return Controlling_Argument (Orig_Node);
+ -- Type conversions are dynamically tagged if the target type, or its
+ -- designated type, are classwide. An interface conversion expands into
+ -- a dereference, so test must be performed on the original node.
+
+ elsif Nkind (Orig_Node) = N_Type_Conversion
+ and then Nkind (N) = N_Explicit_Dereference
+ and then Is_Controlling_Actual (N)
+ then
+ declare
+ Target_Type : constant Entity_Id :=
+ Entity (Subtype_Mark (Orig_Node));
+
+ begin
+ if Is_Class_Wide_Type (Target_Type) then
+ return N;
+
+ elsif Is_Access_Type (Target_Type)
+ and then Is_Class_Wide_Type (Designated_Type (Target_Type))
+ then
+ return N;
+
+ else
+ return Empty;
+ end if;
+ end;
+
-- Normal case
elsif Is_Controlling_Actual (N)