This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: internal compiler error (local struct to select template)
- To: Bob Sidebotham <rns at fore dot com>
- Subject: Re: internal compiler error (local struct to select template)
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at dptmaths dot ens-cachan dot fr>
- Date: 25 Oct 1998 23:24:42 +0100
- Cc: egcs-bugs at cygnus dot com, rns at eng dot fore dot com
- References: <199810251833.NAA05795@sol.eng.fore.com>
>>>>> «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