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]

Re: internal compiler error (local struct to select template)


>>>>> «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


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