User defined static const member

Marc Casaldaliga casaldaliga@ifae.es
Mon Jan 11 09:08:00 GMT 1999


Hi guys, a non built-in type static const member should be dealt by an
standart c++ compiler, shouln´t it be?

Here is the code which caused internal compiler error

#include <iostream.h>
#include <complex.h>

class CircleInCFixedOrigin
{
public:
/*line 16*/    static const complex<double> origin(1.0,1.0);
    double radius;

    CircleInCFixedOrigin(double radius_)
            :radius(radius_)
        {};
    bool Contains( complex<double> point)
        {
            return !(
sqr(point.real()-origin.real())+sqr(point.imag()-origin.imag()) -
sqr(radius) );
        };

};


int main()
{
    CircleInCFixedOrigin circle(2);
    complex<double> first(3.0,1.0), second(3.0,3.0);

    cout<< "this circle does "<<;
    if( !circle.Contains( first) ) cout <<"NOT ";
    cout<<" contain "<< first <<"\n";
    cout<< "and/but does "<<;
    if( !circle.Contains( second) ) cout <<"NOT ";
    cout<<" contain "<< second <<"\n";


    return 0;
}

which produced

eg++ -g complexe.C -o complexe
complexe.C:16: Internal compiler error.
complexe.C:16: Please submit a full bug report to
`egcs-bugs@cygnus.com'.

in egcs-2.91.57 on i686 linux( is that enough information)

By the way, if egcs is going to accept this will it need to allocate
memory for this (non-built-in type) constant at compile-time or it will
be able to do constant folding like it were a built-in type static const
member?

Thanks.




More information about the Gcc-bugs mailing list