This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


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

["Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>] Re: "use of class template `template <T> class Array' as expression"


This might be relevant to the problems reported before, about g++
rejecting some `::'s.



> 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

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