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: Spezialization and friends


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


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