This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
["Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>] Re: "use of class template `template <T> class Array' as expression"
- To: java-discuss at sourceware dot cygnus dot com
- Subject: ["Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>] Re: "use of class template `template <T> class Array' as expression"
- From: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Date: 13 Dec 1999 15:43:18 -0200
This might be relevant to the problems reported before, about g++
rejecting some `::'s.
- To: preilly at allaire dot com
- Subject: Re: "use of class template `template <T> class Array' as expression"
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Mon, 13 Dec 1999 09:39:41 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <199912122210.RAA00621@gsxr.allaire.com>
- Xref: benta.lsd.ic.unicamp.br gcc-bugs:21797
> 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
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them