This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

g++, initialization of Array if its is a class member.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]