Export (0) Print
Expand All
Expand Minimize

Compiler Error C3030

Error Message

'var' : variable in 'reduction' clause/directive cannot have reference type

You can only pass value parameters to certain clauses, such as the reduction clause.

The following sample generates C3030:

// C3030.cpp
// compile with: /openmp /link vcomps.lib
#include "omp.h"

void test(int &r) {
   #pragma omp parallel reduction(+ : r)   // C3030
      ;
}

void test2(int r) {
   #pragma omp parallel reduction(+ : r)   // OK
      ;
}

int main(int argc, char** argv) {
   int& r = *((int*)argv);
   int s = *((int*)argv);

   #pragma omp parallel reduction(+ : r)   // C3030
      ;

   #pragma omp parallel reduction(+ : s)   // OK
      ;
}

Community Additions

ADD
Show:
© 2014 Microsoft