"use of class template `template <T> class Array' as expression"
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri Dec 31 20:54:00 GMT 1999
> I don't think the following code should generate this error. I posted
> this many months ago, but as Martin v. Loewis pointed out I didn't
> include all the necessary information. I've simplified the .cc file
> and hopefully have included all the information necessary this time.
Thanks for your bug report. This is not a bug in g++, but in your
code.
> void createList (Array<::java::lang::String *> *listStrings)
Running 'g++ -dy', we see
Next token is 40 ('(')
Shifting token 40 ('('), Entering state 468
Reading a token: Next token is 311 (PTYPENAME `Array')
Shifting token 311 (PTYPENAME), Entering state 27
Reading a token: Next token is 91 ('[')
Reducing via rule 282 (line 1318), PTYPENAME -> notype_unqualified_id
Next token is '['???? Ah, digraphs. According to 2.5, [lex.digraph]/2,
'<:' is an "alternative token representation" for '['.
If you put a space between the '<' and the ':', g++ will accept it.
As you can see: this has nothing to do with namespaces and templates,
but is on the lexical level. Without a complete example, this is
impossible to track down.
Regards,
Martin
More information about the Gcc-bugs
mailing list