@@ -1912,7 +1912,11 @@ cxx_omp_finish_clause (tree c, gimple_se
make_shared = true;
if (make_shared)
- OMP_CLAUSE_CODE (c) = OMP_CLAUSE_SHARED;
+ {
+ OMP_CLAUSE_CODE (c) = OMP_CLAUSE_SHARED;
+ OMP_CLAUSE_SHARED_FIRSTPRIVATE (c) = 0;
+ OMP_CLAUSE_SHARED_READONLY (c) = 0;
+ }
}
/* Return true if DECL's DECL_VALUE_EXPR (if any) should be
@@ -0,0 +1,19 @@
+// PR c++/81011
+// { dg-do compile }
+
+class A { A (const A&); }; // { dg-message "declared private here" }
+void foo (const A&);
+
+void
+bar (A& a)
+{
+#pragma omp task // { dg-error "is private within this context" }
+ foo (a);
+}
+
+void
+baz (A& a)
+{
+#pragma omp task firstprivate (a) // { dg-error "is private within this context" }
+ foo (a);
+}