This patch ensures that the full view of a designated type is available in the
body of an instance when the related access type acts as an actual in another
instance.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-30  Hristian Kirtchev  <kirtc...@adacore.com>

        * sem_ch12.adb (Check_Private_View): Exchange the private and full view
        of a designated type when the related access type is an actual in an
        instance. This ensures that the full view of designated type is
        available when inside the body of the instance.

Index: sem_ch12.adb
===================================================================
--- sem_ch12.adb        (revision 178307)
+++ sem_ch12.adb        (working copy)
@@ -5749,12 +5749,17 @@
             end if;
 
          --  For composite types with inconsistent representation exchange
-         --  component types accordingly.
+         --  component types accordingly. We exchange the private and full view
+         --  of a designated type when the related access type is an actual in
+         --  an instance. This ensures that the full view of designated type is
+         --  available when inside the body of the instance.
+         --  Is this right ???
 
          elsif Is_Access_Type (T)
            and then Is_Private_Type (Designated_Type (T))
            and then not Has_Private_View (N)
            and then Present (Full_View (Designated_Type (T)))
+           and then Used_As_Generic_Actual (T)
          then
             Switch_View (Designated_Type (T));
 

Reply via email to