views:

75

answers:

1

hello.

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 interpreted 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.

+4  A: 

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).

Georg Fritzsche
thank you. can you provide me with a link to standard? I found April 19, 2000 rev. is it good enough (it does address this particular issue)?
aaa
@aaa: I was referring to C++03, there should be a final draft online. See here for links etc.: http://stackoverflow.com/questions/81656/where-do-i-find-the-current-c-or-c-standard-documents
Georg Fritzsche
I am always amazed when people are able to come up with the exact paragraph from the standard :p
Matthieu M.