diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/typeck.cc | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/goacc/pr118590.C | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 6b54980..a9c32ff 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -4867,6 +4867,11 @@ tree build_omp_array_section (location_t loc, tree array_expr, tree index, tree length) { + if (TREE_CODE (array_expr) == TYPE_DECL + || type_dependent_expression_p (array_expr)) + return build3_loc (loc, OMP_ARRAY_SECTION, NULL_TREE, array_expr, index, + length); + tree type = TREE_TYPE (array_expr); gcc_assert (type); type = non_reference (type); diff --git a/gcc/testsuite/g++.dg/goacc/pr118590.C b/gcc/testsuite/g++.dg/goacc/pr118590.C new file mode 100644 index 0000000..846fe67 --- /dev/null +++ b/gcc/testsuite/g++.dg/goacc/pr118590.C @@ -0,0 +1,29 @@ +// PR c++/118590 +// { dg-do compile } + +template <typename T> +struct A +{ + int z; +}; + +template <typename T, typename U> +struct B +{ + char *w; + A<T> y; +}; + +template <typename T, typename U> +void +foo (B<T, U> &x) +{ + A<T> c = x.y; + #pragma acc enter data copyin(x.w[0 : c.z]) +} + +void +bar (B<int, int> &x) +{ + foo (x); +} |