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]
Other format: [Raw text]

[Bug c++/11585] static template member definition fails


------- Additional Comments From jaco at kroon dot co dot za  2005-02-26 10:03 -------
A more complex example, this code works with gcc 3.3 so this imho is either
incorrect code or a bug in the new parses:

template <class T> class FakeList {
public:
        void foo() {};
};

template <class T> class Factory {
public:
        typedef T* (*CreateType)();
        typedef struct { char *name; CreateType creator; } TypePair;
        static FakeList<TypePair> _types;

        T* createOne() {
                _types.foo();
                return 0;
        };
};

typedef Factory<int> IntFactory;

/*
 * I've tried prefixing this with template <>
 * which them compiles, but fails to link.
 */
FakeList<IntFactory::TypePair> IntFactory::_types;

int main(int, char**) {
        IntFactory blah;
        blah.createOne();

        return 0;
}

I'm using gcc 3.4.3 on amd64.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11585


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