Why is this not compiling? (VC ++ 2015, #pragma omp flush)

Here is a minimal case. Compile with "/ openmp" on Visual C ++ 2015.

#include <vector>
void main()
{
    bool foo = false;
    #pragma omp flush (foo)
    std::vector<int> bar;
}

I get:

C2146   syntax error : missing ';' before identifier 'bar'
C2275   'std::vector<int,std::allocator<_Ty>>' : illegal use of this type as an expression
C2065   'bar' : undeclared identifier

If I comment #pragma, the error will disappear.

If I replaced std::vectorwith int, the error will disappear.

If I put a ;on the line below #pragma, the error will disappear.

+4
source share
1 answer
+1

Source: https://habr.com/ru/post/1629994/


All Articles