------- Additional Comments From max656 at hotmail dot com 2005-01-01 01:37
-------
Subject: RE: friend funtion inside a template class seems to have a probl
Hi lerdsuwa
You came up with an interesting topic - class template specializtion.
I didn't know aboou it. I need further research on that.
As you mentioned, the keyword "typename' is added and compiled and then it
works fine.
Thanks a lot for your detailed explanation.
It haunted me a lot. I was completely stuck for a while even though I found
some other ways.
Tyson
>From: "lerdsuwa at gcc dot gnu dot org" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: [Bug c++/19188] friend funtion inside a template class seems to
>have a problem
>Date: 31 Dec 2004 13:23:03 -0000
>
>------- Additional Comments From lerdsuwa at gcc dot gnu dot org
>2004-12-31 13:23 -------
>The 'typename' keyword is required because later C++ introduces a lot more
>features. Those that interfere with your code are partial specialization
>and specialization. For example, you can now have specialization
>
> template <> class tstack<bool> {
> int link;
> ...
> };
>
>Then when you declare
>
> tstack<bool> t;
>
>it will use the above declaration, where 'link' is now a member data
>instead of a nested class. So the code
>
> tstack<T>::link* p;
>
>which could be interpreted as declaring a variable which is a pointer to
>type
>'tstack<T>::link' if 'T' is 'int'. But when 'T' is 'bool' it could means
>multiplying a member data with another variable named 'p'.
>
>To resolve the ambiguity, later C++ requires the 'typename' keyword to
>treat as pointer declaration, otherwise it will be treated as
>muliplication.
>Older C++ books don't have this 'typename' keyword but newer good books
>from respected authors coming out in the last few years should.
>(Many new C++ books are still wrong).
>
>I know the parser error message could be improved, and there are plenty of
>bug reports elsewhere about it.
>
>--
>
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19188
>
>------- You are receiving this mail because: -------
>You reported the bug, or are watching the reporter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19188