The following test case fails with a linker error. It compiles okay with the
pragma omp task line removed.

template<typename T>
struct A
{
  A() { }
  A(const A&) { }
  void foo() { }
};

int main()
{
  A<int> a;
  #pragma omp task
    a.foo();
  return 0;
}


g++- -fopenmp -Wall task_instantiation.cpp
/tmp/ccQDTSgc.o: In function `main.omp_cpyfn.1':
task_instantiation.cpp:(.text+0x7e): undefined reference to `A<int>::A(A<int>
const&)'
collect2: ld returned 1 exit status

Workarounds:
-declare 'a' shared (mind data consistency)
-instantiate copy constructor explicitly


-- 
           Summary: OpenMP task construct fails to instantiate copy
                    constructor
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: singler at gcc dot gnu dot org


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

Reply via email to