This documentation is archived and is not being maintained.

Compiler Error C3059

Error Message

'var' : 'threadprivate' symbol cannot be used in the 'clause' clause

A threadprivate symbol was used in a clause.

The following sample generates C3059:

// C3059.cpp
// compile with: /openmp
#include "omp.h"
int x, y;
#pragma omp threadprivate(x, y)

int main() {
   #pragma omp parallel private(x, y)   // C3059
   {
      x = y;
   }
}

Possible resolution:

// C3059b.cpp
// compile with: /openmp
#include "omp.h"
int x = 0, y = 0;

int main() {
   #pragma omp parallel firstprivate(y) private(x)
   {
      x = y;
   }
}
Show: