This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GCC rejects valid code?
- From: Roberto Bagnara <bagnara at cs dot unipr dot it>
- To: gccbugs <gcc-bugs at gcc dot gnu dot org>
- Date: Thu, 24 Jan 2008 22:05:02 +0100
- Subject: 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