https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90771
Bug ID: 90771 Summary: Omp for with default(none) and const variable fails to compile Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: jodebo_beck at gmx dot de CC: jakub at gcc dot gnu.org Target Milestone: --- Compiling the following code works with gcc 8.3 but no longer works with gcc 9: int getNumRows() { return 10; } int main() { const int rows = getNumRows(); #pragma omp parallel for default( none ) for( int row = 0; row < rows ; ++row) { } } Compiler with g++ -fopenmp results in the following error message: <source>: In function 'int main()': <source>:9:5: error: 'rows' not specified in enclosing 'parallel' 9 | for( int row = 0; row < rows ; ++row) { | ^~~ <source>:8:13: error: enclosing 'parallel' 8 | #pragma omp parallel for default( none ) | ^~~ Compiler returned: 1 (link to compiler explorer: https://godbolt.org/z/YfO7tD) I am not sure, if the code is not correct or if this is a regression. Clang and MSVC does compile it.