This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: unification bug


Mike Stump <mrs@kithrup.com> writes:

> template<class T, int i1, int i2>
> inline void tsqsort (T b[i1][i2], int (*cmp)(const T*, const T*));
                         ^^^^^

Remember that this is indistinguishable from:

template<class T, int i1, int i2>
inline void tsqsort (T (*b)[i2], int (*cmp)(const T*, const T*));
                       ^^^^

So there's no way for i1 to be deduced.  In order to be able to deduce 
the size of the first dimension of an array, you must pass it by
reference:

template<class T, int i1, int i2>
inline void tsqsort (T (&b)[i1][i2], int (*cmp)(const T*, const T*));
                       ^^^^

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]