1/* { dg-do run } */
2
3#define INLINE inline __attribute__((always_inline))
4extern "C" void abort (void);
5
6template<class> struct Foo {
7        inline bool isFalse() { return false; }
8        template <bool>        void f1() {}
9        template <bool> INLINE void f2() { f1<false>(); }
10        template <bool>        void f3() { f2<false>(); }
11        template <bool> INLINE void f4() { f3<false>(); }
12        int exec2();
13        void execute();
14        inline void unused();
15};
16
17template<class T> inline void Foo<T>::unused() {
18        f4<true>();
19}
20
21static int counter = 0;
22
23template<class T> int Foo<T>::exec2() {
24        static void* table[2] = { &&begin, &&end };
25	if (counter++ > 10)
26	  return 0;
27        goto *(table[0]);
28begin:
29        if (isFalse()) f1<false>();
30end:
31        return 1;
32}
33
34template<class T> void Foo<T>::execute() {
35        int r = 1;
36        while (r) { r = exec2(); }
37}
38
39template class Foo<int>;
40
41int main() {
42        Foo<int> c;
43        c.execute();
44	if (counter < 10)
45	  abort ();
46	return 0;
47}
48