- Code: Select all
struct A { A (); ~A (); A (const A &); };
void foo (A &);
void bar ()
{
A a;
A &b = a;
#pragma omp task
foo (b);
#pragma omp barrier
#pragma omp taskwait
}
b has reference type and is private in the enclosing context. Should it be firstprivate then, and be a reference to a shared variable a (given that a isn't mentioned in the task construct), so if the task is scheduled in a different thread than the thread that encountered the task construct, a firstprivate var b would reference variable a in the thread that encountered the task construct?
