diff mbox

[Ada] Fix spurious "prefix of dereference must be an access type"

Message ID 20110831093404.GA19957@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Aug. 31, 2011, 9:34 a.m. UTC
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  <duff@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.
diff mbox

Patch

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));