Hello, I also had troubles with this point, which was not clearly defined in the standard. This issue was later precised in a defect report : http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#30 To say it shortly, the 'template' keyword is either required or forbidden and gcc 3.4's behaviour is correct, although I would also have appreciated an option to get a warning rather than an error. You're right, many compilers aren't compliant with this rule yet, I am currently trying to get a patch for Sun's CC from the support ; I discovered the problem when porting to Linux and gcc and first thought it was a bug in gcc 3.4 ... Regards, PH --- John M Collins <jmc@xxxxxxxx> a écrit : > Many versions of C++ including earlier versions of > g++ required a "template > qualifer" so that the parser didn't get confused as > defined in Stroustrup > appendix C 13.6 thus > > foo *fp = bar.template shm_cast<foo>(foooffset); > > G++ 3.3.* accepts this without warning. It also > accepts the other version > without the "template" keyword. > > G++ 3.4.* rejects the latter form with > > error: `template' (as a disambiguator) is only > allowed within templates > > I agree that it's much better that the compiler > figures out what I want > without me having to spell it out with > spurious-looking "template"s > everywhere but wouldn't it be better if this was a > "warning" not an "error" > to let people phase it out gently? Stroustrup > doesn't actually say this only > has to be done in a template and in principle you > can see why many compilers > aren't up to the task. > > (I wish I could leave out the "<foo>" too but that > would mean that the result > type would have to be considered). > Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/