aarch64: Add codegen support for SVE2 faminmax
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / unchanging1.C
blob6beb513bba92f49e17505f65902d6610ea424f78
1 // { dg-do run  }
2 // { dg-options "-O2" }
3 // { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
5 #include <iostream>
6 #include <complex>
8 using namespace std;
10 class A {
11 protected:
12   int a;
13   complex<double> *b;
14 public:
15   A(int n);
16   inline complex<double>& operator[] (int x);
19 A::A(int n)
21   a = n;
22   b = new complex<double>[a];
23   for (int i=0; i<a; i++) b[i] = complex<double>(0.0,0.0);
26 inline complex<double>& A::operator[](int x)
28   if (x < 0 || x >= a)
29     cout << "x error" << endl;
30   return b[x];
33 void foo ()
35   int n = 5;
36   A *o = new A(n);
37   A *p = new A(n);
38   for (int i = 0; i < n; i++) {
39     cout << i << endl;
40     (*o)[i] *= complex<double>((*p)[i].real(), (*p)[i].imag());
41   }
44 int main()
46   foo();