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]

Re: egcs-1.1.2 template problem?


On Apr 22, 1999, nbecker@fred.net wrote:

> egcs-1.1.2 accepts this test, which actually makes no sense:

Nope, it's correct, because operator= did not have to be
instantiated.  If you add an assignment `i=0;' to your program, it'll
complain.

> template<int bits, class Signedness>
> class Int {
[snip]
>     if (x > Signedness::Max<bits>())

> Int.H:18: parse error before `('

Once again, it's correct.  Because Signedness is a template argument,
you *must* indicate that Max is supposed to be a member template,
otherwise `<' and '>' will be parsed as less-than and greater-than
operators.

      if (x > Signedness::template Max<bits>())

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Brasil
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists



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