2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr79034.C
blob802c0aa5584a608d28c1a9c9409ee4743c7e96b6
1 /* { dg-do compile } */
3 extern "C" {
4     float sqrtf(float);
7 class T {
8 public:
9     float floats[1];
11     inline float length() const {
12         return sqrtf(floats[0]);
13     }
16 void destruct(void *);
18 class Container {
20     T Ts[1];
22 public:
23     ~Container() {
24         destruct((void *)Ts);
25     }
27     T& operator[](int n) {
28         return Ts[0];
29     }
32 void fill(Container&);
34 void doit()
36   Container data;
37   float max = 10;
39   int i, j, k;
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   }