aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr81308-2.C
blob: 97e3409e06c4fc3d65168c28cf04edf92536c319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* { dg-do compile } */
/* { dg-options "-w -O2" } */

struct A {
  int operator[](int) const {}
};
struct B {
  void m_fn1();
};
struct C {
  virtual bool m_fn2(int, unsigned &, A &, int &, unsigned long &, bool);
};
template <class MCAsmParserImpl> struct D {
  D(int) { MCAsmParserImpl(0, 0, 0, 0); }
};
int a;
namespace {
struct F : C {
  bool m_fn2(int, unsigned &, A &, int &, unsigned long &, bool);
  unsigned m_fn3(const A &, B &);
  F(int, int, int, int) {}
};
}
bool F::m_fn2(int, unsigned &, A &p3, int &, unsigned long &, bool) {
  B b;
  m_fn3(p3, b);
}
void fn1() { D<F>(0); }
unsigned F::m_fn3(const A &p1, B &p2) {
  for (int *p;; p++)
    switch (*p) {
    case 0:
      p1[a];
    case 1:
      p2.m_fn1();
    }
}