This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
g++, initialization of Array if its is a class member.
- From: Wlodzimierz Lipert <wlodzimierz dot lipert at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 4 May 2005 17:16:08 +0200
- Subject: g++, initialization of Array if its is a class member.
- Reply-to: Wlodzimierz Lipert <wlodzimierz dot lipert at gmail dot com>
Hi!
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] /* 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.