http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45942

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-08 
15:59:08 UTC ---
(In reply to comment #9)
> 
> I really tried everything, but I have to admit I missed that one. Sorry. But
> you have to admit that it is a rather unnatural way to make friends. 
> Furthermore, the third parameter Z is missing (I would prefer A<X,Y>&Z), but
> that does not seem to be a problem for the compiler.

You can just add it if it makes you feel better. That parameter isn't used in
the friend declaration, so giving it a name is optional.  YOu can call it Z or
whatever you want, it doesn't matter.

> Thus it seems that the bug is that c++ is designed is such a way that it gives
> error messages which are incorrect.

C++ doesn't specify the text of error messages, it says what is valid and what
is not.  The compiler rejected your code because it's not valid.

I don't know why you think the error message is incorrect.

This is a template declaration:
  template <classA &instanceA> friend class classB;
It has one parameter.
classB was already declared as a template with three parameters.
So you get this error message:

pr45942.cc:9:45: error: redeclared with 1 template parameter
pr45942.cc:3:57: note: previous declaration ‘template<class T, int C, classA<T,
C>& instanceA> class classB’ used 3 template parameters

That seems correct to me.

> If you would have followed the title of my bug report immediately instead of
> saying that is was invalid, then the discussion would have been unnecessary.

But your bug report IS invalid.
I repeat, you said there was a bug in the compiler, I said there isn't.

If you had said "please help me fix my code" that would have been a different
discussion (and you'd have been asked to go somewhere else, like a C++ forum or
newsgroup)

Despite that, you have succeeded in turning it into a discussion of why your
code is not valid.

> Now it is still odd that the first attempt gives an error so lately. The
> template precompiler counts three arguments and the template instantiator
> counts one, which is not very consistent.

There's no "template precompiler"

Please take this somewhere else, GCC's bugzilla is not the place for it.

Reply via email to