This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problems with templates: Internal compiler error
- To: egcs-bugs at cygnus dot com
- Subject: Problems with templates: Internal compiler error
- From: sargor at guinan dot mcnc dot org (Chandramouli Sargor)
- Date: Thu, 23 Jul 1998 15:52:54 -0400
- Cc: sargor at guinan dot mcnc dot org
Hello all,
I just installed egcs 1.0.3 yesterday on my Pentium machine
running FreeBSD and tried to compile some programs that use
templates that had compiled fine under Solaris on a Sun.
#############################################################
> g++ -v
Reading specs from /usr/local/lib/gcc-lib/i386-unknown-freebsd2.2.5/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
#############################################################
When I compile, I get:
> g++ a.C
In file included from a.C:3:
mq.H:27: Internal compiler error.
mq.H:27: Please submit a full bug report to `egcs-bugs@cygnus.com'.
-------------------------------------------------------------------
Here's the relevant code from two include files mq.H and pool.H:
FILE pool.H:
........
template <class item>
class PoolElement {
friend class Pool<item>;
friend class PoolMgr<item>;
public:
void* operator new(size_t s) {
return((item*) pm.allocate());
}
void operator delete(void *n) {
pm.deallocate((item*)n);
}
private:
item* next;
item* prev;
Pool<item>* pool;
static PoolMgr<item> pm;
};
........
FILE mq.H:
.......
#include "pool.H"
Line 27: class qmsg : public PoolElement<qmsg> { // g++ COMPLAINS ABOUT THIS LINE
Line 28: public:
Line 29: long int tid;
Line 30: int type;
Line 31: void* bufp;
Line 32: };
.......
File a.C
#include "mq.H"
main()
{
qmsg *qm = new qmsg;
}
-------------------------------------------------------------------------
I would greatly appreciate any help I can get to fix this. Also,
does egcs.1.0.3 allow templates to be defined in one file and
instantiated in another - I get 'undefined symbols' errors when
I try to do this.
Thanks!
Chandru
sargor@mcnc.org