Debian Codegraph @

gcc/testsuite/g++.dg/analyzer/infinite-recursion-3.C

raw
1 /* Adapted from g++.dg/warn/Winfinite-recursion-3.C */
2
3 typedef __SIZE_TYPE__ size_t;
4
5 /* Might throw. */
6 void f ();
7
8 void warn_f_call_r (int n)
9 {
10 if (n > 7)
11 f ();
12 warn_f_call_r (n - 1);
13 }
14
15 void warn_f_do_while_call_r (int n)
16 {
17 f ();
18 do
19 {
20 f ();
21 warn_f_do_while_call_r (n - 1);
22 }
23 while (1);
24 }
25
26
27 struct X
28 {
29 X (int);
30 ~X ();
31 };
32
33 int warn_class_with_ctor (int n)
34 {
35 X x (n);
36 return n + warn_class_with_ctor (n - 1);
37 }
38
39
40 int nowarn_throw (int n)
41 {
42 if (n > 7)
43 throw "argument too big";
44
45 return n + nowarn_throw (n - 1);
46 }
47
48 extern int* eipa[];
49
50 void warn_call_new (int i)
51 {
52 eipa[i] = new int;
53
54 warn_call_new (i - 1);
55 }
56
57 void* operator new[] (size_t n)
58 {
59 char *p = new char[n + sizeof (n)];
60 *(size_t*)p = n;
61 return p + sizeof n;
62 }