1// PR tree-optimization/30558
2// { dg-do compile }
3// { dg-options "-fopenmp" }
4
5template <typename T> struct F
6{
7  ~F ();
8  F (T);
9  const T &operator[] (unsigned i) const;
10};
11
12template <typename T> F<T> foo (const F<T> &x)
13{
14  return F<T> (x[1]);
15}
16
17struct G
18{
19  G () { bar (2); }
20  F<int> &operator () (F<int> x);
21  void bar (int);
22};
23
24int
25main ()
26{
27  try
28  {
29    G g;
30#pragma omp parallel for
31    for (int i = 0; i < 10; ++i)
32      {
33	F<int> j (i);
34	F<int> f = g (j);
35	F<int> h = foo (f);
36      }
37  }
38  catch (int &e)
39  {
40  }
41}
42