OSDN Git Service

2009-07-17 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / gomp / pr31598.C
1 // PR c++/31598
2 // { dg-do compile }
3 //
4 // Copyright (C) 2007 Free Software Foundation, Inc.
5 // Contributed by Theodore.Papadopoulo
6 //   16 Apr 2007 <Theodore.Papadopoulo@sophia.inria.fr>
7
8 int i;
9 template <typename> struct A { A() {} };
10 template <typename> struct C { C() { i++; } C(const C &) { i += 2; } };
11 struct D { D() {} };
12
13 struct M { typedef double E; };
14
15 template <typename T>
16 struct R
17 {
18   R()
19   {
20     typedef A<typename T::E> B;
21     B b;
22     #pragma omp parallel for firstprivate(b) schedule(guided)
23       for (int t = 0; t < 10; ++t)
24         ;
25   }
26 };
27
28 template <typename T>
29 struct S
30 {
31   S()
32   {
33     typedef C<typename T::E> B;
34     B b;
35     #pragma omp parallel for firstprivate(b)
36       for (int t = 0; t < 10; ++t)
37         ;
38   }
39 };
40
41 struct U
42 {
43   U()
44   {
45     D b;
46     #pragma omp parallel for firstprivate(b)
47       for (int t = 0; t < 10; ++t)
48         ;
49   }
50 };
51
52 int
53 main ()
54 {
55   R<M> r;
56   S<M> s;
57   U u;
58   return 0;
59 }