1 /* Copy of g++.dg/warn/Winfinite-recursion-2.C */
3 /* { dg-do compile { target c++11 } } */
16 template <int a> struct f { static constexpr int c = a; };
21 template <unsigned long, typename...> struct m;
22 template <unsigned long ab, typename i, typename j, typename... ac>
23 struct m<ab, i, j, ac...> : m<ab + 1, i, ac...> {};
24 template <unsigned long ab, typename j, typename... ac>
25 struct m<ab, j, j, ac...> : f<ab> {};
26 template <unsigned long, typename...> struct n;
27 template <unsigned long ab, typename j, typename... ac>
28 struct n<ab, j, ac...> : n<ab - 1, ac...> {};
29 template <typename j, typename... ac> struct n<0, j, ac...> : h {};
30 template <typename... l> class F {
31 template <typename i> struct I : m<0, i, l...> {};
32 template <int ab> struct s : n<ab, l...> {};
33 static const type_info *const b[];
35 template <typename ag>
38 return *this; /* { dg-warning "-Wanalyzer-infinite-recursion" } */
46 long t() const { return o; }
47 const type_info &m_fn3() const { return *b[o]; }
48 template <int ab> typename s<ab>::e *m_fn4() const {
53 template <int ab> void m_fn5() const {
55 const type_info &r = m_fn3();
58 template <typename i> void u() const { m_fn5<I<i>::c>(); }
60 template <typename... l> const type_info *const F<l...>::b[] {&typeid(l)...};
61 using am = unsigned char;
63 enum bd : am { be = 2 };
64 using bf = F<int, int, H>;
66 template <typename bg> void v() const { ah.u<bg>(); }