g++, initialization of Array if its is a class member.
Wlodzimierz Lipert
wlodzimierz.lipert@gmail.com
Wed May 4 15:27:00 GMT 2005
Hi! A little mistake during copy/paste. :)
template < typename T, int S >
class A{
public:
T _V[S ];
int a;
}
template < typename T >
class B : public A< T, 2 /* const */ >
{
B( T t ) : A<T,2 >::V[0]( t ), A<T, 2>::V[1] ( t ) /* ERROR reported by
compiler. Why? */
, a( 1 ) /* no error */ {};
B( T t1, T t2 ){
A<T,2>::V[0] = t1; // no error.
}
};
It apears that index operator [] is not treated properly during initialization.
More information about the Gcc
mailing list