Internal Compiler Error report

Alexander Samoilov spike@Gambit.Msk.SU
Thu Apr 30 15:07:00 GMT 1998


Hi all,

The following code fragment

---------------------------------

template <class T> class List;
 
template <class T>
class ListIterator
{
public:
    
    ListIterator (const List<T>& aList);

//  This declaration causes internal compiler error
    ListIterator (const ListIterator<T>& rhs);

    operator void* () const;
     
    ListIterator<T>& operator++ ();

};

template <class T>
class List
{
public:
    
    int length () const {
        int len = 0;
        for (ListIterator<T> li(*this); li; ++li)
            len++;
        return len;
    }
};

void test(List<int>& vals)
{
    int val = vals.length();
}
--------------------------------------------------------------------

causes ICE:

--------------------------------------------------------------------
t12.cc: In method `int List<int>::length<int>() const':
t12.cc:27: Internal compiler error.
t12.cc:27: Please submit a full bug report to `egcs-bugs@cygnus.com'.

for all snapshots later than 1998-03-02 including the latest
CVS snapshot. This has been tested on Linux gnulibc1 and Sparc Solaris
2.5.1.

Please note, that after commenting copy constructor declaration
this example can be compiled by egcs. gcc-2.8.1 compiles this sample ok.

Hope this help.

Regards,

Alexander Samoilov




More information about the Gcc-bugs mailing list