This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

C++ bug, appearantly template related.


I've stumbled on an Internal compiler error in gcc.

I use gcc-2.95.2 (built with ./configure --enable-cpplib && make
bootstrap, but I don't think that matters).

My system, according to uname: "Linux katt.streamserve.com 2.2.5-15 #1
Mon Apr 19 23:00:46 EDT 1999 i686 unknown".

I try compiling the C++ file below by saying "gcc -c bug.cxx", and gcc
fails with

  bug.cxx:68: Internal compiler error.
  bug.cxx:68: Please submit a full bug report.
  bug.cxx:68: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for instructions.
  
Source file appended below. I'm not sure if it is really valid C++, as
gcc dies before I get any useful error messages.

Regards,
/Niels

-----8<---------
/* xslt_hashtable.h */

class xslt_hash_table;
class xslt_hash_entry;

class xslt_hash_table
{
protected:
  class iterator;
  friend iterator;
  xslt_hash_table();
  
  virtual ~xslt_hash_table() = 0;
};

class xslt_hash_entry
{
  friend xslt_hash_table;
  friend xslt_hash_table::iterator;
  
protected:
  xslt_hash_entry *m_next;
  unsigned m_hash;

  xslt_hash_entry(unsigned hash)
    : m_hash(hash) {}
  virtual ~xslt_hash_entry() = 0;
};

class xslt_hash_table::iterator
{
  xslt_hash_table *m_ht;
  unsigned m_i;
  xslt_hash_entry *m_p;
  
public:
  iterator(xslt_hash_table *ht)
    : m_ht(ht), m_i(0), m_p(0) {};
  xslt_hash_entry *next();
};


/* xslt_stylesheet.h */

class XSLName;

template <class V>
class XSLHashTable : xslt_hash_table
{
public:
  struct XSLAssoc : xslt_hash_entry
    {
    /* NOTE: Doesn't own either names or values */
    XSLName *m_name;
    V *m_value;

    XSLAssoc(XSLName *name, V *value)
      : m_name(name), m_value(value)
      , xslt_hash_entry(name->Hash())
      {}
  };
  class iterator;
  friend iterator;
};

template<class V>
class XSLHashTable<V>::iterator : xslt_hash_table::iterator
{
public:
  iterator(XSLHashTable<V> *ht) : xslt_hash_table::iterator(ht) {}
  V* next() { return (V*) xslt_hash_table::iterator::next(); }
};

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