http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48869

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-04 
16:37:40 UTC ---
Say:
template<typename T>
struct B
{
  B () {}
  B (const B&) = delete;
  ~B () {}
};

template<typename T>
struct A
{
  A () {}
  A (const A&) { B<T> b; B<T> c = b; }
  void foo () {}
  ~A() {}
};

int
main()
{
  A<int> a;
  #pragma omp task shared(a)
    a.foo ();
  #pragma omp task default(shared)
    a.foo ();
  #pragma omp parallel shared(a)
    #pragma omp task
      a.foo ();
#if 0
  #pragma omp task
    a.foo ();
  #pragma omp parallel private (a)
    #pragma omp task
      a.foo ();
#endif
  return 0;
}

With #if 0 all the a's are shared, even though it isn't immediately obvious in
all cases that it is that way without going through all the gimplify.c rules.
With #if 1 instead of #if 0 those two last tasks have implicit firstprivate(a)
and thus need to instantiate the copy ctor.

Reply via email to