This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-2.91.14 crash on HP (specialisation of member template)

I get a Internal compiler error today with the following code. Egcs has
been compile with make bootstrap

laninsa:paubert/tmp> g++ -v
Reading specs from /home2/paubert/logiciels/egcs/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.91.14/specs
gcc version egcs-2.91.14 980315 (gcc-2.8.0 release)
laninsa:paubert/tmp> uname -a       
HP-UX laninsa B.10.20 A 9000/780 2010120751 two-user license
laninsa:egcs/c++> m ./template_specialisation_04                                                     2
g++ -DHAVE_CONFIG_H -I. -I/home2/paubert/creatis/crop/c++ -I.. -I/home2/paubert/creatis/crop/crop/src/autodiff -I.. -I/home2/paubert/creatis/crop/c++  -Wall -g -I/home2/paubert/include -Wtemplate-debugging -c /home2/paubert/creatis/crop/c++/template_specialisation_04.cxx
/home2/paubert/creatis/crop/c++/template_specialisation_04.cxx:40: Internal compiler error.
/home2/paubert/creatis/crop/c++/template_specialisation_04.cxx:40: Please submit a full bug report to `'.
make: *** [template_specialisation_04.o] Error 1

--- BEGIN CODE ------------------------------------------------------------

template <class T> class Plus
    static inline T apply( T const& t1, T const& t2 ) {return t1+t2;};

template <class A> class Binary
    explicit Binary ( A const& a1, A const& a2): _a1(a1), _a2(a2) {};
      /// declaration of a templated member
    template <template <class T> class Operator>
    inline A apply( A const& a1, A const& a2) const 
      { return Operator<A>::apply(a1,a2);  };
       /// specialisation
    template <>
    inline A apply<Plus>( A const& d1,A const&d2 ) const 
      {return Plus<A>::apply(_a1,_a2);};
    A const& _a1;
    A const& _a2;

int main()
    Binary<double> bp(10.0,20.0);
    Binary<double> bm(10.0,20.0);

    if( bp.size() != 10 )
        return 1;
    if( 5.0 != bp.template apply<Plus>(2.0,3.0) )
        return 1;

    if( -10.0 != bm.template apply<Plus>(2.0,3.0) )
        return 2;
    return 0;

--- END CODE ------------------------------------------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]