[Bug c++/11107] New: Crash on template member call / static data member inititalization

tbouton@streamwide.com gcc-bugzilla@gcc.gnu.org
Fri Jun 6 00:17:00 GMT 2003


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.



More information about the Gcc-bugs mailing list