[v3] libstdc++/5280

Loren James Rittle rittle@latour.rsch.comm.mot.com
Wed Jan 23 13:47:00 GMT 2002


> c++locale.cc: In function `void std::__convert_to_v(const char*, _T&,
>   std::_Ios_Iostate&, int* const&, int) [with _T = long double]':
> c++locale.cc:171: using `typename' outside of template
> make[3]: *** [c++locale.lo] Error 1
>
> Isn't this allowed? The typename is inside the template.

The answer is a tad tricky.  Here is how I understand it.

This is clearly a case where the keyword typename is not required by
the standard since the type specified is not dependent.  However,
section 14.6 of ISO 14882 explicitly says: "The keyword typename shall
only be used in template declarations and definitions.  [...]  The
keyword typename shall only be applied to qualified names, but those
names need not be dependent."

We might think that an explicit template specialization (as is the
case at the point of the error quoted above) would be a template
declaration.  However, according to the grammar of C++, it is not.

Regards,
Loren
-- 
Loren J. Rittle
Senior Staff Software Engineer, Distributed Object Technology Lab
Networks and Infrastructure Research Lab (IL02/2240), Motorola Labs
rittle@rsch.comm.mot.com, KeyID: 2048/ADCE34A5, FDC0292446937F2A240BC07D42763672



More information about the Libstdc++ mailing list