🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1036

bug in handling static const object of the enclosing class

#1036
From: zao
Date: Tue, 01 Sep 1992 14:38
79 lines
2556 bytes
I think I find a bug in the GNU C++ Compiler v.2.2.2.
It occurs while a static const object was defined to be of the same class
as the one which encloses it, for example:

class X
{ public:
     static const X xo;
     // ...
}

The result is an Internal compiler error while running cc1plus.
A sample program and its compiler output are enclosed for your examination:

// test.H file --------------------------------

class X
{
  private:
    int x;
  public:
    static const X x0;
    X( int );
};

class Y
{
  private:
    X xx;
  public:
    Y();
}
    
// test.C file --------------------------------

#include "test.H"

X::X( int xi )
{
    x = xi;
}

const X X::x0( 0 );

Y::Y()
{
    xx = X::x0;
}

// Compiler output --------------------------------

zao@rainbow > g++ test.C -v -g -L/usr/local/lib -I/usr/local/lib/g++-include -l
m -lc_s -c
Reading specs from /usr/local/lib/gcc-lib/mips-sgi/2.2.2/specs
gcc version 2.2.2
 /usr/local/lib/gcc-lib/mips-sgi/2.2.2/cpp -lang-c++ -v -I/usr/local/lib/g++-inc
lude -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dunix -Dmips -Dsgi -DSVR3 -
Dhost_mips -DMIPSEB -DSYSTYPE_SYSV -D__unix__ -D__mips__ -D__sgi__ -D__SVR3__ -D
__host_mips__ -D__MIPSEB__ -D__SYSTYPE_SYSV__ -D__unix -D__mips -D__sgi -D__SVR3
 -D__host_mips -D__MIPSEB -D__SYSTYPE_SYSV -D__CHAR_UNSIGNED__ -g -D__EXTENSIONS
__ -D_MIPSEB -D_SYSTYPE_SYSV -D_LANGUAGE_C_PLUS_PLUS test.C /usr/tmp/cca03954.i
GNU CPP version 2.2.2 [AL 1.1, MM 19] Silicon Graphics Mips
 /usr/local/lib/gcc-lib/mips-sgi/2.2.2/cc1plus /usr/tmp/cca03954.i -quiet -dumpb
ase test.cc -g -version -o /usr/tmp/cca03954.s
GNU C++ version 2.2.2 [AL 1.1, MM 19] Silicon Graphics Mips compiled by GNU C ve
rsion 2.2.2.
test.C:6: return type specification for constructor invalid
test.C: In method `Y::Y ()':
test.C:16: too few arguments for constructor `X'
test.C:16: in base initialization for class `X'
/usr/local/bin/gcc: Internal compiler error: program cc1plus got fatal signal 6
zao@rainbow >

-----------------------------------------------

Please advice me what to do.

Many Thanx!!

- John.
Technical Details
Message-ID: <9209011438.AA20222@lindt.harvard.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!das.harvard.edu!zao

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!das.harvard.edu!zao
From: zao@das.harvard.edu
Subject: bug in handling static const object of the enclosing class
Message-ID: <9209011438.AA20222@lindt.harvard.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 1 Sep 1992 14:38:44 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 80