A reduction for an incomplete array type used to produce an assert
fail during codegen. Now it produces a diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335907
91177308-0d34-0410-b5e6-
96231b3b80d8
// OpenMP [2.9.3.3, Restrictions, C/C++, p.3]
// A variable that appears in a private clause must not have an incomplete
// type or a reference type.
- if (S.RequireCompleteType(ELoc, Type,
+ if (S.RequireCompleteType(ELoc, D->getType(),
diag::err_omp_reduction_incomplete_type))
continue;
// OpenMP [2.14.3.6, reduction clause, Restrictions]
--- /dev/null
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 150 -o - %s
+
+int incomplete[];
+
+void test() {
+#pragma omp parallel reduction(+ : incomplete) // expected-error {{a reduction list item with incomplete type 'int []'}}
+ ;
+}
+
+// complete to suppress an additional warning, but it's too late for pragmas
+int incomplete[3];