http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56635

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #3 from Markus Trippelsdorf <markus at trippelsdorf dot de> 
2013-03-17 04:44:38 UTC ---
markus@x4 tmp % cat test.ii
template<typename>struct A;
template<typename _Tp>A<_Tp>operator/(A<_Tp>, A<_Tp>& p2)
{
  A<_Tp> a;
  a /= p2;
  return a;
}

template<typename _Tp>bool operator!=(A<_Tp>& p1, A<_Tp>&)
{
  return p1.real();
}

template<>struct A<double>
{
  double& real()
  {
    return __real__ _M_value;
  }

  template<typename _Tp>void operator/=(A<_Tp>&)
  {
    _M_value /= 10;
  }

  _Complex double _M_value;
};

template<class T>class B {
  T *buf;

public:

  B(int, bool);
  T& operator[](int)
  {
    return buf[0];
  }
};

struct C
{
  C(const int&);
  typedef A<double>Ty;
  typedef B<Ty>    DataT;
  A<double>zero;
  enum InitType
  { NOZERO };
  virtual C* DivInv(C *);
};
template<class Sp>class D : Sp {
  typedef typename Sp::Ty    Ty;
  typedef typename Sp::DataT DataT;
  DataT dd;

public:

  D(const int&, C::InitType);
  Ty& operator[](int)
  {
    return dd[0];
  }

  D* DivInv(C *);
};

template<class Sp>D<Sp> *D<Sp>::DivInv(C *)
{
  if ((*this)[0] != this->zero) (*this)[0] = (*static_cast<D *>(0))[0] /
                                             (*this)[0];
  else (*this)[0] = (*static_cast<D *>(0))[0];
  return 0;
}

D<C> *b = new D<C>(0, C::NOZERO);
template<class Sp>D<Sp>::D(const int&, C::InitType) : Sp(0), dd(0, 0)
{}

markus@x4 tmp % c++ -Wextra -Wall -c -O3 test.ii
test.ii: In member function ‘D<Sp>* D<Sp>::DivInv(C*) [with Sp = C]’:
test.ii:67:26: internal compiler error: in find_lattice_value, at
tree-complex.c:151
 template<class Sp>D<Sp> *D<Sp>::DivInv(C *)
                          ^

Reply via email to