🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by zao Tue, 01 Sep 1992 14:38
bug in handling static const object of the enclosing class
#1036
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads