This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC rejects valid code?



While looking at the rules governing struct/union declarations in C, I stumbled upon this example:

union A {
  int i;
  float f;
};

void
foo(struct A** p) {
  *p = 0;
}

This is accepted by both Comeau and the Intel C compiler, but is rejected
by GCC 4.1.2 and 4.3.0 on the grounds that

bug.c:7: error: ‘A’ defined as wrong kind of tag

My interpretation is that line 7 does not define `union A' with the
wrong kind of tag;  it declares a (totally unrelated) `struct A'.
However, I am not sure.  Should I file a bug report for this?
All the best,

Roberto

--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]