c++/358: Re: C++ bug, appearantly template related.
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Wed Jun 28 13:56:00 GMT 2000
>Number: 358
>Category: c++
>Synopsis: C++ bug, appearantly template related.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: analyzed
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Wed Jun 28 13:56:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: nisse@lysator.liu.se (Niels Möller)
>Release: 2.95.2
>Organization:
>Environment:
>Description:
Date: 28 Jun 2000 12:02:57 +0200
Original-Message-ID: <nnituuunqm.fsf@sture.lysator.liu.se>
Lines: 94
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
>How-To-Repeat:
/* xslt_hashtable.h */
class xslt_hash_table;
class xslt_hash_entry;
class xslt_hash_table
{
public:
class iterator;
friend iterator;
protected:
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(); }
};
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list