[comp.lang.c] Need help with gcc constructors

brennan@rtp.dg.com (Dave Brennan) (01/22/90)

In the following code segment, I don't understand why gcc complains
"invalid lvalue in unary `&'" about the "trash" initilization but has no
problem with the "junk" initialization.  I invoked the compiler 
"gcc -g -c trial.c"   Can somebody enlighten me here?  Thanks.


typedef enum { 
  enum_1,     
  enum_2   
} tag_t;

typedef struct {
  tag_t type;
  char *class_data;
} BAZ_T;

extern int foo();
extern char *bar;

main()
{
  char *junk = (char *) & (BAZ_T) { enum_1, (char *) foo };
  char *trash = (char *) & (BAZ_T) { enum_2, (char *) bar };
}
--
                                                   _________
Dave Brennan, User Interfaces, Data General Corp. /      brennan@dg-rtp.dg.com 
Research Triangle Park, North Carolina, 27709    /  ...mcnc!rti!dg-rtp!brennan
Hm: (919) 460-5725  Wk: (919) 248-6330 _________/ dave_brennan@rpitsmts.bitnet