The following program doesn't work correctly when compiled with -fopenmp: ============================== #include<cstdio>
template<int> void foo() { #pragma omp parallel { printf("ALL\n"); #pragma omp master printf("MASTER\n"); } } int main() { foo<0>(); return 0; } ============================== The output (with two threads) is just: ALL ALL If I make foo a non-template function, I get the correct output: ALL ALL MASTER -- Summary: [gomp] "#pragma omp master" doesn't work in templates Product: gcc Version: unknown Status: UNCONFIRMED Keywords: wrong-code, openmp Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24734