c++/10527: Internal error during template compile
Giovanni Bajo
giovannibajo@libero.it
Tue Apr 29 10:46:00 GMT 2003
The following reply was made to PR c++/10527; it has been noted by GNATS.
From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
<Endlisnis@mailc.net>,
<gcc-bugs@gcc.gnu.org>,
<rcampbell@tropicnetworks.com>,
<nobody@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>
Cc: "Wolfgang Bangerth" <bangerth@ices.utexas.edu>
Subject: Re: c++/10527: Internal error during template compile
Date: Tue, 29 Apr 2003 12:45:06 +0200
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=10527
Confirmed. Reduced snippet is:
------------------------------------------------------------
template <class T>
struct Foo
{};
template <class T>
void Foo<T>::NON_EXISTENT(int* val = new int())
{}
------------------------------------------------------------
pr10527.cpp:7: error: no `
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
This is ice-on-illegal-code, 3.3/3.4 regression with respect to 2.95 where
the same code shows a correct error message.
Note that if Foo is a normal class, the ICE disappears but the error message
is _ugly_:
------------------------------------------------------------
struct Foo
{};
void Foo::NON_EXISTENT(int* val = new int())
{}
------------------------------------------------------------
pr10527.cpp:5: error: no `void Foo::NON_EXISTENT(int* = (operator
new(unsigned
int)(4), ((true, (((*<anonymous>) <unknown operator> 0), (<anonymous>
<unknown operator> false))), <anonymous>)))' member function declared in
class `Foo'
For the original poster, your code is illegal for several reasons. First,
the parameter list of your makeQueryHandler() function at definition time
does not match the parameter list at declaration time. Then, if you want to
define a template member function of a template class outside the class
definition, the syntax you must use is the following:
template <class-template-parameters>
struct Foo
{
template <memfun-template-parameters>
void func(..........);
};
template <class-template-parameters>
template <memfun-template-paramters>
void Foo<class-template-parameter-names>::func(.......)
{
.....
}
Hope this helps
Giovanni Bajo
More information about the Gcc-prs
mailing list