https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66571
Bug ID: 66571 Summary: Template substitution causes some OpenMP rejects-valid Product: gcc Version: 5.1.1 Status: UNCONFIRMED Keywords: openmp Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- template <typename T, typename U> extern void bar (T, T, U); template <typename T, typename U> void foo (T a, T b, U c) { #pragma omp parallel for simd shared (a, c) reduction (+:b) for (int i = 0; i < 10; i++) bar<T> (a, b, c); #pragma omp target map(tofrom:a, c[0:5]) ; #pragma omp task depend(inout:c[4:2]) ; T d = a; T e = b; U f = c; #pragma omp parallel for simd shared (d, f) reduction (+:e) for (int i = 0; i < 10; i++) bar<T> (d, e, f); #pragma omp target map(tofrom:d, f[0:5]) ; #pragma omp task depend(inout:f[4:2]) ; } void baz () { int a = 0, b = 0, cb[10] = {}, *c = cb; foo <int, int *> (a, b, c); foo <int &, int *&> (a, b, c); } is rejected with -fopenmp right now, because during tsubst_omp_clauses if changing a non-REFERENCE_TYPE decl into a REFERENCE_TYPE decl convert_from_reference is called, while finish_omp_clauses (and later code) checks if OMP_CLAUSE_DECL is a decl (and later code relies on it).