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]
Other format: [Raw text]

[Bug c++/15503] [3.4/3.5 regression] nested template problem


------- Additional Comments From giovannibajo at libero dot it  2004-05-18 10:36 -------
I need to know which way to take with this. In my reading of the standard, the 
keyword 'template' to name nested dependent templates is not allowed in neither 
the base-specifier nor the mem-initializer clause. The grammar explicitally 
says:

base-specifier:
     ::opt nested-name-specifieropt class-name
     virtual access-specifieropt ::opt nested-name-specifier[opt] class-name
     access-specifier virtualopt ::opt nested-name-specifier[opt] class-name

mem-initializer-id:
     ::opt nested-name-specifier[opt] class-name
     identifier

And there is no "template[opt]". After all, it makes sense as a symbol '<' in 
that context can only be the start of a template argument list.

This would also match what happens with typename, which is more explicitally 
disallowed in those contexts ([temp.res]/5): "The keyword typename is not 
permitted in a base-specifier or in a mem-initializer; in these contexts a 
qualified-name that depends on a template-parameter (14.6.2) is implicitly 
assumed to be a type name."

Gaby, do you agree with my reading of the standard? If so, I can make a patch 
that emits a proper diagnostic when 'template' is found in those contexts, and 
fix the rejects-valid shown in this bug (if you remove 'template' from the 
testcase, it still does not accept it).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it, gdr at gcc dot gnu dot
                   |                            |org
           Keywords|                            |rejects-valid


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


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