This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Template declaration, internal compiler error - g++2.95.2
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Template declaration, internal compiler error - g++2.95.2
- From: "Kirk L. Duffin" <duffin at cs dot niu dot edu>
- Date: Tue, 22 Feb 2000 12:56:11 -0600 (CST)
- cc: dzabinsk at niu dot edu
The following code triggers an internal compiler error in g++ version
2.95.2. This has been verified on a Debian Linux (potato) i686 system and
also on a SunOS 5.7 sparc.
The code was compiled with
g++ -Wall -c bug.cc
No preprocessed version is included as the output is identical to the
code provided here.
/* bug.cc
Bug discovered by Daniel A. Zabinski dzabinsk@niu.edu
*/
template<class Le>
class L
{
public:
void f(void(*)(Le &));
};
template<class X>
template<class T>
void p(T&);
int main()
{
L<int> v;
v.f(p);
return 0;
}
The code problem is the incorrect declaration of p with the double
template declaration. If "template<class X>" is removed, the error is not
triggered. The error is triggered in main() at v.f(p); The compiler
problem is that no informative error message is generated.
Using this same code g++ 2.8.1 generates
no matching function for call to `L<int>::f ({unknown type})'
candidates are L<int>::f(void (*)(int &))
which is more useful.
-------------------------------------------------------------------------
Kirk L. Duffin | phone: (815) 753-2628
Computer Science Department |
Northern Illinois University | e-mail: duffin@cs.niu.edu
DeKalb,IL 60115 |
-------------------------------------------------------------------------