Compiler Error C3039
'var' : index variable in OpenMP 'for' statement cannot be a reduction variable
An index variable is implicitly private, so the variable cannot be used in a reduction clause in the enclosing parallel directive.
Example
The following sample generates C3039:
// C3039.cpp
// compile with: /openmp /c
int g_i;
int main() {
int i;
#pragma omp parallel reduction(+: i)
{
#pragma omp for
for (i = 0; i < 10; ++i) // C3039
g_i += i;
}
}