* semantics.c (finish_omp_for): If processing_template_decl, just build
MODIFY_EXPR for init instead of calling cp_build_modify_expr.
* g++.dg/gomp/pr37533.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140613
138bc75d-0d04-0410-961f-
82ee72b054a4
+2008-09-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/37533
+ * semantics.c (finish_omp_for): If processing_template_decl, just build
+ MODIFY_EXPR for init instead of calling cp_build_modify_expr.
+
2008-09-23 Aldy Hernandez <aldyh@redhat.com>
* typeck.c (build_array_ref): Pass location to cp_build_binary_op.
}
if (!processing_template_decl)
- init = fold_build_cleanup_point_expr (TREE_TYPE (init), init);
- init = cp_build_modify_expr (decl, NOP_EXPR, init, tf_warning_or_error);
+ {
+ init = fold_build_cleanup_point_expr (TREE_TYPE (init), init);
+ init = cp_build_modify_expr (decl, NOP_EXPR, init, tf_warning_or_error);
+ }
+ else
+ init = build2 (MODIFY_EXPR, void_type_node, decl, init);
if (cond && TREE_SIDE_EFFECTS (cond) && COMPARISON_CLASS_P (cond))
{
int n = TREE_SIDE_EFFECTS (TREE_OPERAND (cond, 1)) != 0;
+2008-09-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/37533
+ * g++.dg/gomp/pr37533.C: New test.
+
2008-09-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/vect/slp-widen-mult-s16.c: Fix typo.
--- /dev/null
+// PR c++/37533
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+template<int>
+void
+f1 ()
+{
+#pragma omp parallel for
+ for (int i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
+ ;
+}
+
+template<int>
+void
+f2 ()
+{
+ int i;
+#pragma omp parallel for
+ for (i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
+ ;
+}
+
+template<typename T>
+void
+f3 ()
+{
+#pragma omp parallel for
+ for (T i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
+ ;
+}
+
+template<typename T>
+void
+f4 ()
+{
+ T i;
+#pragma omp parallel for
+ for (i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
+ ;
+}
+
+void
+bar ()
+{
+ f1<0> (); // { dg-message "instantiated from here" }
+ f2<1> (); // { dg-message "instantiated from here" }
+ f3<int> (); // { dg-message "instantiated from here" }
+ f4<int> (); // { dg-message "instantiated from here" }
+}