This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9380: nested template problem for methods without argument : parsing error
- From: "Vincent PICAUD" <PICAUD dot VINCENT at wanadoo dot fr>
- To: <lerdsuwa at gcc dot gnu dot org>,<gcc-bugs at gcc dot gnu dot org>,<gcc-prs at gcc dot gnu dot org>,<nobody at gcc dot gnu dot org>,<picaud dot vincent at wanadoo dot fr>,<gcc-gnats at gcc dot gnu dot org>
- Date: Wed, 22 Jan 2003 11:51:09 +0100 (MET)
- Subject: Re: c++/9380: nested template problem for methods without argument : parsing error
- References: <20030121141505.28979.qmail@sources.redhat.com>
Thank you very much for your valuable explanations...
I apologise for my mistake... I didn't know this C++ syntax : "a.template how_many<Vertex>();"
Now all work fine and thanks to you I can continue to develop my code.
Regards,
-- Vincent Picaud.
>Messsage du 21/01/2003 14:15
>De : <lerdsuwa@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>, <picaud.vincent@wanadoo.fr>, <gcc-gnats@gcc.gnu.org>
>A : <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>, <picaud.vincent@wanadoo.fr>
>Copie à :
>Objet : Re: c++/9380: nested template problem for methods without argument : parsing error
>
> Synopsis: nested template problem for methods without argument : parsing error
>
> State-Changed-From-To: open->closed
> State-Changed-By: lerdsuwa
> State-Changed-When: Tue Jan 21 14:15:05 2003
> State-Changed-Why:
> Not a bug. Your code inside 'foo_2':
> a.how_many<Vertex>();
> 'a' depends on the template parameter 'dim' so the compiler
> doesn't know if 'how_many' is a variable, a type, or a
> template. For example, you can declare a specialization
> template<> class A<Volumn> { int how_many; }
> Then 'A<Vertex>.how_many' is a template function but
> 'A<Volumn>.how_many' is a variable.
>
> When you are referring to a template when the context is
> template parameter dependent, you need the 'template'
> keyword as in:
> a.template how_many<Vertex>();
> The same applies to the example in the Fix section:
> a.template how_many<Vertex>(id_foo<Vertex>());
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9380
>