C++ template parameter/class ambiguity
while testing with different version of g++, the following problem came up
template<class bra>
struct Transform<bra, void> : kernel::Eri::Transform::bra {
static const size_t ni = bra::A::size;
bra::A
is interprete开发者_Go百科d as kernel::Eri::Transform::bra::A
, rather than template argument by g++ 4.1.2. on the other hand, g++ 4.3 gets it right.
what should be correct behavior according to standard?
Meanwhile, I refactor slightly to make problem go away.
Seems to me like gcc 4.1.2 was right. §14.6.1/7 (ISO/IEC 14882, C++03):
In the definition of a class template or in the definition of a member of such a template that appears outside of the template definition, for each base class which does not depend on a template-parameter (14.6.2), if the name of the base class or the name of a member of the base class is the same as the name of a template- parameter, the base class name or member name hides the template-parameter name (3.3.7).
精彩评论