aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr81194.C
blob: 08f6fc0f39f39994c9e67b9822433c0d0ffae4f3 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// { dg-do compile { target c++17 } }
// { dg-options "-O2 -fno-exceptions" }
// { dg-additional-options "-Wno-return-type" }

template <class a> struct b { typedef a *c; };
class e {};
template <typename a> class d {
public:
  typedef typename b<a>::c c;
  c begin();
  c end();
};
struct f {
  enum { g } h;
};
struct i {
  d<f *> j();
};
struct l {
  d<i *> k();
};
class ac;
class o {
public:
  o(int *, int *, int *, ac *);
};
class ac {
public:
  ac(e);
  virtual o *ae(int *, int *, int *, int *);
};
class p {
  void af(f *m) {
    switch (m->h)
    case f::g:
      ag();
  }

public:
  void n() {
    l ah;
    for (i *ai : ah.k())
      for (f *m : ai->j())
        af(m);
  }
  virtual void ag() { __builtin_unreachable(); }
};
template <typename = int> class an : o {
public:
  an(int *, int *, int *, int *, ac *);
};
class q : ac {
public:
  q() : ac([]() -> e {}()) {}
  o *ae(int *ap, int *aq, int *ar, int *as) { an(ap, aq, ar, as, this); }
};
template <typename at>
an<at>::an(int *, int *aq, int *ar, int *as, ac *au) : o(aq, ar, as, au) {
  p().n();
}
void av() { new q; }