This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11107] New: Crash on template member call / static data member inititalization
- From: "tbouton at streamwide dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jun 2003 00:16:13 -0000
- Subject: [Bug c++/11107] New: Crash on template member call / static data member inititalization
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11107
Summary: Crash on template member call / static data member
inititalization
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: tbouton@streamwide.com
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: i386-linux
GCC host triplet: i386-linux
GCC target triplet: i386-linux
Here is the code that crashes when gcc -c on both RedHat 7.3 / gcc 2.96 and
Mandrake 9.1 / gcc 3.2.2 (gcc -c source.cpp)
Note that this is NOT correct code: a semicolon is missing between class
declaration and static init ! The code does NOT crash when the semicolon is added.
class Method {
};
template<class T> class TCreator {
public:
virtual T* Create()=0;
};
template<class T> class Factory {
public:
void Register(TCreator<T>*);
};
Factory<Method> f;
class ConcreteMethod : public Method {
public:
class Creator : public TCreator<Method> {
public: Method * Create() { return new ConcreteMethod; };
Creator() {
f.Register(this);
} ;
};
static Creator creator;
ConcreteMethod();
}
ConcreteMethod::Creator ConcreteMethod::creator; // <--- crashes here.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.