Dear gcc-bugs-mailinglist, I'm having a problem with inheriting from a partial specialization of a class, and in particular using a public templatized instance variable of the partial specialization. I've genericized the code with somebody else to the following reduction which shows the essence of the problem.
template <typename I, typename O> class B { public: char x; }; template <typename O> class B<O, void> { public: char x; }; template <typename O> class C : public B<O, void> { public: void function() { printf("%c", x); } }; The problem is that the call using x claims it doesn't exist. This has been confirmed on 3.6.4 and on 4.1.1 for both x86 and x86_64, but this code does work on 3.3.6. As far as I can tell from literature, Stroustrup (the c++ programming language) agrees in the chapter on templates with an explicit example that you must specify all specializations before using them. He also is explicit in requiring you to include them all in any class using them, so that the compiler always picks the same. Leaving out the partial instantiation doesn't solve it either. As far as I know or can tell, there's nothing preventing a match to the correct parent template class in all cases. Why doesn't this work? Is it still wrong? As far as I can tell, this is a bug. Regards, Peter Bindels