[gnu.g++.bug] initialization of reference error

tiemann@arkesden.eng.sun.com (Michael Tiemann) (02/22/90)

   From: Glenn Engel <glenne@hplsla.hp.com>
   Elmto: bug-g++@prep.ai.mit.edu (g++ bugs)
   Date: Tue, 20 Feb 90 11:20:31 PST
   X-Mailer: Elm [version 1.7]

   compiler:  g++1.36.3 for hp9k320g.
   source:

   int *j;
   short * &p = (short *) j;
   int * &q = j;

   The initialization of q is fine, however the initialization of p is done
   by reading the contents of j.  I expected both p and q to point to j.


   #NO_APP
   gcc_compiled.:
   .globl _p
   .data
	   .even
   _p:
	   .long __$tmp_0
   .globl _q
	   .even
   _q:
	   .long _j
   .text
	   .even
   .globl __GLOBAL_$I$p
   __GLOBAL_$I$p:
	   link a6,#0
	   movel _j,__$tmp_0
   L1:
	   unlk a6
	   rts
   .stabs "___CTOR_LIST__",22,0,0,__GLOBAL_$I$p
   .lcomm __$tmp_0,4
   .comm _j,4

Casts are not lvalues.  cfront says "sorry, not implemented:
initializer for static reference not an lvaue".  Maybe GNU C++ should
give a similar warning.

Michael