This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Spezialization and friends
- To: egcs-bugs at cygnus dot com, garloff at kg1 dot ping dot de
- Subject: Re: Spezialization and friends
- From: Kriang Lerdsuwanakij <lerdsuwa at scf-fs dot usc dot edu>
- Date: Thu, 19 Mar 1998 19:49:24 -0800
Kurt Garloff wrote:
> friend Tensor<rank> func <> (double&);
> lead to this error:
>
> garloff@kg1:/home/garloff/C > egcc -O2 bug_fullspec.cc -DBUG
> bug_fullspec.cc:42: incomplete type unification
> bug_fullspec.cc:42: func<>' does not match any template declaration
> bug_fullspec.cc:42: confused by earlier errors, bailing out
>
> but does compile without the friend function ?
>
> Shouldn't the behaviour independent of it? (And in my opinion succeed
> in both cases?)
The error message generated by egcs is correct. You have to use
friend Tensor<rank> func <rank> (double&);
When specifying specialization with empty argument list '<>', the
missing arguments can be filled automatically by the compiler if it can
be deduced by looking at function parameters. In this case, the only
parameter is 'double&', so egcs don't know what should be the missing
arguments. The function return type does not involve in template
argument deduction however.
--Kriang