1// PR tree-optimization/31769
2// { dg-options "-O2 -fopenmp" }
3// { dg-do compile }
4
5struct B
6{
7  B () {}
8  virtual ~B () {}
9};
10struct C
11{
12  C (int x, int y) {}
13};
14template<typename T, int U>
15struct D
16{
17  D () {}
18  ~D () {}
19};
20struct E
21{
22  E () {}
23  ~E () {}
24  D<int, 1> e;
25};
26struct A
27{
28  B *b;
29  A () { b = __null; }
30  ~A () { if (b != __null) delete b; }
31};
32struct F : public A
33{
34  explicit F (int x) { foo (0); }
35  F (const F &x) {}
36  F (F &x, C y) {}
37  F operator () (C x) const
38  {
39    return F (const_cast<F &>(*this), x);
40  }
41  template <typename U> F & operator+= (const U &);
42  void foo (int);
43  E f;
44};
45
46int
47main ()
48{
49  try
50  {
51    F f (10);
52    F g (10);
53    C h (0, 9);
54#pragma omp parallel for
55    for (int i = 0; i < 2; ++i)
56      g += f (h);
57  }
58  catch (int &e)
59  {
60  }
61}
62