Please take a look at the snippet of code below; which models a code style I am trying to port onto RedHat 7.0 class Base { public: union {
I am sorry about the earlier message, I unwittingly 'committed' my message. Herein is the full description of the bug in question: class Base { public: union { int m_i; }; }; class Derived : public Base { public: union { int m_i; }; }; int main () { return 1; } If I run this snippet of code through the above-mentioned compiler, it spewed out the error message appended below. As far as I know this code is in compliance with ANSI C++ standard, I cant think of any clause being violated. Could you please investigate the problem with your latest compiler, thanks. =====================Start of compiler 2.96 output================= Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.0) /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -v - D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix - Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu (i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ good.cpp good.ii GNU CPP version 2.96 20000731 (Red Hat Linux 7.0) (cpplib) (i386 Linux/ELF) ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/include/g++-3 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include /usr/include End of search list. /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus good.ii -quiet -dumpbase good.cpp -version -o good.s GNU C++ version 2.96 20000731 (Red Hat Linux 7.0) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.0). good.cpp:17: declaration of `int Derived::{anonymous union}::m_i' good.cpp:7: conflicts with previous declaration `int Base::{anonymous union}::m_i' =====================End of compiler 2.96 output=================
I've submitted a patch for this to gcc-patches as http://gcc.gnu.org/ml/gcc-patches/2001-01/msg02201.html, am awaiting approval for this. It will probably make it into the next gcc-c++ rpm.
Fixed in gcc-c++-2.96-73 and above.
Thanks for the fix.