+2016-07-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/71941
+ * cp-gimplify.c (cp_genericize): For nested cp_genericize calls
+ save/restore bc_label array.
+
2016-07-21 Jason Merrill <jason@redhat.com>
PR c++/70781
if (DECL_CLONED_FUNCTION_P (fndecl))
return;
+ /* Allow cp_genericize calls to be nested. */
+ tree save_bc_label[2];
+ save_bc_label[bc_break] = bc_label[bc_break];
+ save_bc_label[bc_continue] = bc_label[bc_continue];
+ bc_label[bc_break] = NULL_TREE;
+ bc_label[bc_continue] = NULL_TREE;
+
/* Expand all the array notations here. */
if (flag_cilkplus
&& contains_array_notation_expr (DECL_SAVED_TREE (fndecl)))
gcc_assert (bc_label[bc_break] == NULL);
gcc_assert (bc_label[bc_continue] == NULL);
+ bc_label[bc_break] = save_bc_label[bc_break];
+ bc_label[bc_continue] = save_bc_label[bc_continue];
}
\f
/* Build code to apply FN to each member of ARG1 and ARG2. FN may be
--- /dev/null
+// PR c++/71941
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct A { A (); A (A &); ~A (); };
+
+template <int N>
+struct B
+{
+ struct C { A a; C () : a () {} };
+ C c;
+ void foo ();
+};
+
+void
+bar ()
+{
+ B<0> b;
+#pragma omp task
+ for (int i = 0; i < 2; i++)
+ b.foo ();
+}