This patch fixes an obscure bug, in which an error "prefix of dereference must
be an access type" is given incorrectly. The spurious error would occur in an
instance of a generic if an implicit dereference of an expression of a private
type is used.
No simple test is available.

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

2011-08-31  Bob Duff  <d...@adacore.com>

        * exp_ch4.adb (Expand_N_Selected_Component): Use the full type, in case
        the access type is private; we don't care about privacy in expansion.

Index: exp_ch4.adb
===================================================================
--- exp_ch4.adb (revision 178368)
+++ exp_ch4.adb (working copy)
@@ -7920,6 +7920,7 @@
       --  Insert explicit dereference if required
 
       if Is_Access_Type (Ptyp) then
+         Set_Etype (P, Ptyp); -- in case it's private
          Insert_Explicit_Dereference (P);
          Analyze_And_Resolve (P, Designated_Type (Ptyp));
 

Reply via email to