This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Possible G++ compiler problem (or is what I am doing plain old wrong)
- From: Dave Gotwisner <Dave dot Gotwisner at harmonicinc dot com>
- To: "'gcc-help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 21 Aug 2003 14:48:17 -0700
- Subject: Possible G++ compiler problem (or is what I am doing plain old wrong)
I have a small piece of code that gives a fatal compiler error. Depending
upon the version of G++, the error reported is different, but it is fatal
just the same.
A simple test program that causes the problem follows:
using namespace std;
class baseObj
{
public:
int getBaseObj(void) { return m_BaseObj; }
private:
int m_BaseObj;
};
class OSE : virtual public baseObj
{
public:
int getOSEVar(void) { return Config.m_OSEVar; }
private:
struct Config
{
int m_OSEVar;
} Config;
};
class OSEEther : virtual public OSE
{
public:
int getOSEEtherVar(void) { return Config.m_OSEEtherVar; }
private:
struct Config
{
int m_OSEEtherVar;
} Config;
};
int
main(int ac, char **av)
{
OSEEther a;
}
The compiler used, and the errors reported are as follows:
g++ -v [linux, target x86 linux -- standard compiler distributed
with RedHat 8.0]:
Reading specs from
/usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info --enable-shared
--enable-threads=posix --disable-checking --host=i386-redhat-linux
--with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Compile line:
g++ -c -o classtest.o classtest.cc
Error:
classtest.cc:31: Internal compiler error in
pop_binding, at cp/decl.c:1178
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for
instructions.
g++ (Solaris host, VxWorks solaris simulator target):
Reading specs from
/a/tools/europa/tornado/2.2.io/host/sun4-solaris2/bin/../lib/gcc-lib/sparc-w
rs-solaris2.5.1/gcc-2.96/specs
gcc version gcc-2.96 (2.96+) 19990621 VxWorks 5.5
Error:
classtest.cc:31: Internal compiler error.
classtest.cc:31: Please submit a full bug report.
g++ (Solaris host, MIPS target for VxWorks):
Reading specs from
/a/tools/europa/tornado/2.2.io/host/sun4-solaris2/bin/../lib/gcc-lib/mips-wr
s-vxworks/2.96-mips3264-010729/specs
gcc version 2.96-mips3264-010729 (2.96+) VxWorks 5.5
Error: [same as other VxWorks target compiler error]
I am assuming that what I am trying to do is valid, since both Config's are
private structures, so should not be accessible outside the actual class.
People who I have spoken to here at work indicate that it should be valid,
someone is performing a similar test with Microsoft's C++ compiler on
windows to see what it does.
Because this code is generated from an XML schema, I would prefer not to
internally change the names if I can avoid it.
Any help or feed back will be appreciated. If this list indicates that it
is valid code that should compile, I will also report it to WindRiver,
although I doubt that they have anyone that can fix it.
Dave