{
omp_target_walk_data data;
data.this_expr_accessed = false;
+ data.current_object = NULL_TREE;
- tree ct = current_nonlambda_class_type ();
- if (ct)
- {
- tree object = maybe_dummy_object (ct, NULL);
- object = maybe_resolve_dummy (object, true);
- data.current_object = object;
- }
- else
- data.current_object = NULL_TREE;
+ if (DECL_NONSTATIC_MEMBER_P (current_function_decl) && current_class_ptr)
+ if (tree ct = current_nonlambda_class_type ())
+ {
+ tree object = maybe_dummy_object (ct, NULL);
+ object = maybe_resolve_dummy (object, true);
+ data.current_object = object;
+ }
if (DECL_LAMBDA_FUNCTION_P (current_function_decl))
{
--- /dev/null
+// PR c++/106829
+
+namespace std
+{
+ template <typename> class complex;
+ template <> struct complex<double> { complex (double); _Complex double d; };
+}
+struct S { void static foo (); };
+
+void
+S::foo ()
+{
+#pragma omp target
+ std::complex<double> c = 0.0;
+}