summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/pr31598.C
blob: 3ebcead5ac999f67bb264a2ff760f88bc4290552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// PR c++/31598
// { dg-do compile }
//
// Copyright (C) 2007 Free Software Foundation, Inc.
// Contributed by Theodore.Papadopoulo
//   16 Apr 2007 <Theodore.Papadopoulo@sophia.inria.fr>

int i;
template <typename> struct A { A() {} };
template <typename> struct C { C() { i++; } C(const C &) { i += 2; } };
struct D { D() {} };

struct M { typedef double E; };

template <typename T>
struct R
{
  R()
  {
    typedef A<typename T::E> B;
    B b;
    #pragma omp parallel for firstprivate(b) schedule(guided)
      for (int t = 0; t < 10; ++t)
	;
  }
};

template <typename T>
struct S
{
  S()
  {
    typedef C<typename T::E> B;
    B b;
    #pragma omp parallel for firstprivate(b)
      for (int t = 0; t < 10; ++t)
	;
  }
};

struct U
{
  U()
  {
    D b;
    #pragma omp parallel for firstprivate(b)
      for (int t = 0; t < 10; ++t)
	;
  }
};

int
main ()
{
  R<M> r;
  S<M> s;
  U u;
  return 0;
}