TREE_PURPOSE (parm), fn,
i - is_method, tf_warning_or_error);
t = build_call_a (fn, i, argarray);
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (t)))
+ t = build_cplus_new (TREE_TYPE (t), t, tf_warning_or_error);
t = fold_convert (void_type_node, t);
t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
append_to_statement_list (t, &ret);
TREE_PURPOSE (parm), fn,
i - is_method, tf_warning_or_error);
t = build_call_a (fn, i, argarray);
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (t)))
+ t = build_cplus_new (TREE_TYPE (t), t, tf_warning_or_error);
t = fold_convert (void_type_node, t);
return fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
--- /dev/null
+// PR c++/114572
+// { dg-do run }
+// { dg-options "-fopenmp -O0" }
+
+#include <stdlib.h>
+
+struct S
+{
+ S () : s (0) {}
+ ~S () {}
+ S operator= (const S &x) { s = x.s; return *this; }
+ int s;
+};
+
+int
+main ()
+{
+ S s;
+ #pragma omp parallel for lastprivate(s)
+ for (int i = 0; i < 10; ++i)
+ s.s = i;
+ if (s.s != 9)
+ abort ();
+}