Compiler Error C3030
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3030.
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
;
}
Show: