[v3] libstdc++/5280
Gabriel Dos Reis
gdr@codesourcery.com
Thu Jan 24 04:55:00 GMT 2002
Loren James Rittle <rittle@latour.rsch.comm.mot.com> writes:
| > 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.
Your reading matches my understanding: `typename' should not be used
in non-template codes, and an explicit specialization is not a
template code.
-- Gaby
More information about the Libstdc++
mailing list