member template class problem in egcs-1.1a

Shiying Zhao zhao@greatwall.cs.umsl.edu
Sat Sep 5 13:10:00 GMT 1998


#include <iostream.h>

template <class TYPE>
class A
{    
  public:
    template <class T> class Iter
    {
      public:
        Iter(T b) : b(b) {}
  
        T b;
    };

    typedef TYPE ValueType;
    typedef Iter<A*> Iterator;
    typedef Iter<const A*> ConstIterator;

    A(ValueType a) : a(a) {}

#ifdef INLINE
    Iterator test(Iterator b) { return b; }
#else
    Iterator test(Iterator b);
#endif

    ValueType a;
};

#ifndef INLINE
template <class TYPE>
A<TYPE>::Iterator A<TYPE>::
test(Iterator b)
{
    return b;
}
#endif

int main()
{
    A<int> a(10);
    A<int>::Iterator b = &a;

    cout << a.a << " " << b.b->a << endl;
    
    return 0;
}

/*
1) make DEFS=-DINLINE t1
t1
10 10

2) make
t1.cc:34: Internal compiler error 892.
t1.cc:34: Please submit a full bug report to `egcs-bugs@cygnus.com'.
 */




More information about the Gcc-bugs mailing list