Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr79034.C

raw
1 /* { dg-do compile } */
2
3 extern "C" {
4 float sqrtf(float);
5 }
6
7 class T {
8 public:
9 float floats[1];
10
11 inline float length() const {
12 return sqrtf(floats[0]);
13 }
14 };
15
16 void destruct(void *);
17
18 class Container {
19
20 T Ts[1];
21
22 public:
23 ~Container() {
24 destruct((void *)Ts);
25 }
26
27 T& operator[](int n) {
28 return Ts[0];
29 }
30 };
31
32 void fill(Container&);
33
34 void doit()
35 {
36 Container data;
37 float max = 10;
38
39 int i, j, k;
40
41 for (i = 0; i < 10; i++) {
42 for (j = 1; j < 10; j++) {
43 if (max < 5)
44 break;
45 fill( data);
46 max = data[0].length();
47 for (k = 1; k < j; k++) {
48 max = 5;
49 }
50 }
51 }
52 }