2 template <typename _Tp, long _Nm> struct A {
3 typedef _Tp _Type[_Nm];
4 static _Tp &_S_ref(const _Type &p1, int p2) {
5 return const_cast<_Tp &>(p1[p2]);
8 template <typename _Tp, long _Nm> struct B {
9 typedef A<_Tp, _Nm> _AT_Type;
10 typename _AT_Type::_Type _M_elems;
11 _Tp &operator[](long p1) const { return _AT_Type::_S_ref(_M_elems, p1); }
14 void foo(int p1, int &p2) {
23 __attribute__((noinline))
24 void test1(const B<int, 2> &p1) { foo(p1[0], p1[1]); }
25 void test(B<B<int, 2>, 2> &p1) {
28 foo(p1[0][0], p1[0][1]);