@@ -2187,6 +2187,10 @@ cxx_omp_predetermined_sharing (tree decl
&& DECL_OMP_PRIVATIZED_MEMBER (decl)))
return OMP_CLAUSE_DEFAULT_SHARED;
+ /* Similarly for typeinfo symbols. */
+ if (VAR_P (decl) && DECL_ARTIFICIAL (decl) && DECL_TINFO_P (decl))
+ return OMP_CLAUSE_DEFAULT_SHARED;
+
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}
@@ -0,0 +1,12 @@
+// PR c++/91118
+// { dg-do compile }
+// { dg-additional-options "-fsanitize=undefined" }
+
+#include <iostream>
+
+void
+foo ()
+{
+#pragma omp parallel default(none) shared(std::cerr)
+ std::cerr << "hello" << std::endl;
+}
@@ -0,0 +1,14 @@
+// PR c++/91118
+// { dg-do compile }
+
+#include <typeinfo>
+
+struct S { virtual ~S (); };
+void bar (const std::type_info &, const std::type_info &);
+
+void
+foo (S *p)
+{
+ #pragma omp parallel default (none) firstprivate (p)
+ bar (typeid (*p), typeid (S));
+}