internal compiler error (local struct to select template)

Gabriel Dos Reis Gabriel.Dos-Reis@dptmaths.ens-cachan.fr
Sun Oct 25 14:50:00 GMT 1998


>>>>> «Bob», Bob Sidebotham <rns@fore.com> wrote:

Bob> This gets an internal compiler error. I suspect that I'm not really
Bob> allowed to put struct fun inside set() (a minor annoyance) if I want
Bob> to use it for template resolution. Pushing it up a level into class
Bob> xxx makes the problem go away.

Bob> class base {
Bob> public:
Bob>     template<class F> void iterate(const F&) {
Bob> 	F::func();
Bob>     }
Bob> };

Bob> template<class T> class xxx {
Bob> public:
Bob>     base x;
Bob>     void set() {
Bob> 	struct fun {
Bob> 	    static void func() { }
Bob> 	};
Bob> 	x.iterate(fun());
Bob>     }
Bob> };

Bob> xxx<int> ZZ;

The Standard doesn't allow you to use local classes as template arguments.

-- Gaby



More information about the Gcc-bugs mailing list