bug in template function specialization

Alexandre Oliva oliva@dcc.unicamp.br
Mon Jun 8 00:03:00 GMT 1998


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




More information about the Gcc-bugs mailing list