pr81314.C 391 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // PR c++/81314
  2. // { dg-do link }
  3. template <int N>
  4. struct S {
  5. S () { s = 0; }
  6. S (const S &x) { s = x.s; }
  7. ~S () {}
  8. int s;
  9. };
  10. void
  11. foo (S<2> &x)
  12. {
  13. #pragma omp taskloop
  14. for (int i = 0; i < 100; ++i)
  15. x.s++;
  16. }
  17. void
  18. bar (S<3> &x)
  19. {
  20. #pragma omp task
  21. x.s++;
  22. }
  23. int
  24. main ()
  25. {
  26. S<2> s;
  27. S<3> t;
  28. #pragma omp parallel
  29. #pragma omp master
  30. {
  31. foo (s);
  32. bar (t);
  33. }
  34. }