This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bug in template function specialization
- To: David Mazieres <dm at reeducation-labor dot lcs dot mit dot edu>
- Subject: Re: bug in template function specialization
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 08 Jun 1998 02:16:00 -0300
- Cc: egcs-bugs at cygnus dot com
- References: <199806072118.RAA09635@reeducation-labor.lcs.mit.edu>
David Mazieres <dm@reeducation-labor.lcs.mit.edu> writes:
> When I try to compile the following program with egcs-2.90.29 980515
> (egcs-1.0.3 release) on OpenBSD, it tells me to submit a bug report:
> egcs-bug.C:11: Internal compiler error.
> egcs-bug.C:11: Please submit a full bug report to `egcs-bugs@cygnus.com'.
There's no such thing as partial specialization of template
functions. You can only overload or fully specialize template
functions.
> #include <stdlib.h>
> template<class T> inline bool isarray () { return false; }
> template<class T, size_t n> inline bool isarray<T[n]> ()
> { return true; }
The latest snapshot of egcs reports:
test.cc:11: template-id `isarray<T[n]>' in declaration of primary template
You'd better rework your code, so that you depend on either partial
specialization of class templates or declare (possibly unused)
function arguments for template argument deduction.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil