[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    Internal compiler error
From:       pamc () implicit ! com (Patrick MERISSERT-COFFINIERES)
Date:       1999-01-30 11:03:33
[Download RAW message or body]

With egcs-1.1.1, who display its version as egcs-2.91.60, both under
cygwin for nt, and under Linux Redhat 5.2 (Leeloo), the following
program:

/=============================================================
template <int I>
class outer {
public:
  template<int J>
  class inner {
  public:
    static inline int value();
  };
};

template<int I> template <int J>
inline int outer<I>::inner<J>::value()
{return I/J;}

template<int I> template <>
class outer<I>::inner<0>
{                                                 // <= error
  public:
    static inline int value(){return 0;}
  };
}
/=============================================================

raises an "Internal compiler error" on the "inner<0>" line. I am not
sure whether it SHOULD compiler or not. I am trying explicit
specialization of a template class member of a template class! I also
tried partial specification, but it raised a different error:

/=============================================================
template <int I>
class outer {
public:
  template<typename X,int J>
  class inner {
  public:
    static inline int value(X);
  };
};

template<int I> template <typename X,int J>
inline int outer<I>::inner<X,J>::value(X x)
{return x*I/J;}

template<int I> template <typename X>
class outer<I>::inner<X,0> {
// <= error
  public:
    static inline int value(X){return 0;}
  };
}
/=============================================================

got:

  tst.cc:16: got 1 template parameters for `class
outer<I>::outer<I>::inner<X,0>'
  tst.cc:16:   but 2 required

but again, I do not know whether this should compile or not.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic