diff gcc/ada/exp_intr.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/ada/exp_intr.adb	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/ada/exp_intr.adb	Thu Oct 25 07:37:49 2018 +0900
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2017, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2018, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -402,7 +402,10 @@
       end if;
 
       --  Rewrite and analyze the call to the instance as a class-wide
-      --  conversion of the call to the actual constructor.
+      --  conversion of the call to the actual constructor. When the result
+      --  type is a class-wide interface type this conversion is required to
+      --  force the displacement of the pointer to the object to reference the
+      --  corresponding dispatch table.
 
       Rewrite (N, Convert_To (Result_Typ, Cnstr_Call));
 
@@ -924,7 +927,8 @@
       Arg       : constant Node_Id    := First_Actual (N);
       Loc       : constant Source_Ptr := Sloc (N);
       Typ       : constant Entity_Id  := Etype (Arg);
-      Desig_Typ : constant Entity_Id  := Designated_Type (Typ);
+      Desig_Typ : constant Entity_Id  :=
+                    Available_View (Designated_Type (Typ));
       Needs_Fin : constant Boolean    := Needs_Finalization (Desig_Typ);
       Root_Typ  : constant Entity_Id  := Underlying_Type (Root_Type (Typ));
       Pool      : constant Entity_Id  := Associated_Storage_Pool (Root_Typ);