This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/39684] GCC accepts template keyword where Comeau rejects it.
- From: "dodji at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Apr 2009 16:43:24 -0000
- Subject: [Bug c++/39684] GCC accepts template keyword where Comeau rejects it.
- References: <bug-39684-629@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from dodji at gcc dot gnu dot org 2009-04-08 16:43 -------
Subject: Re: GCC accepts template keyword where Comeau rejects
it.
bangerth at gmail dot com a écrit :
> ------- Comment #2 from bangerth at gmail dot com 2009-04-08 13:11 -------
> The testcase is indeed invalid. We should reject it.
Sorry, could you explain why the test case is invalid ?
I am not sure if it is invalid or not actually :)
The C++ spec in 14.2 [temp.names], point 5 says:
"If a name prefixed by the keyword template is not the name of a template, the
program is ill-formed."
In our case, the name "search" is the name of a template.
The same point 5 later says:
"As is the case with the typename prefix, the template prefix is allowed in
cases where it is not strictly necessary; i.e., when the nested-name-specifier
or the expression on the left of the -> or . is not dependent on a
template-parameter, or the use does not appear in the scope of a template."
So, I would be inclined to think that we are in a case where the 'template'
keyword is not is necessary. But does that make its use invalid ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39684