* [C++ PATCH] Fix OpenMP class iterator error recovery (PR c++/67511)
@ 2015-09-10 7:48 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2015-09-10 7:48 UTC (permalink / raw)
To: gcc-patches
Hi!
The gimplifier does not like if error_mark_node is forcefully wrapped into a
NOP_EXPR.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk
and 5 branch.
2015-09-10 Jakub Jelinek <jakub@redhat.com>
PR c++/67511
* semantics.c (handle_omp_for_class_iterator): Don't wrap
error_mark_node into a NOP_EXPR to void_type_node.
* g++.dg/gomp/pr67511.C: New test.
--- gcc/cp/semantics.c.jj 2015-08-24 18:27:13.000000000 +0200
+++ gcc/cp/semantics.c 2015-09-09 11:51:31.576714709 +0200
@@ -6453,7 +6453,8 @@ handle_omp_for_class_iterator (int i, lo
iter_init = build_x_modify_expr (elocus,
iter, PLUS_EXPR, iter_init,
tf_warning_or_error);
- iter_init = build1 (NOP_EXPR, void_type_node, iter_init);
+ if (iter_init != error_mark_node)
+ iter_init = build1 (NOP_EXPR, void_type_node, iter_init);
finish_expr_stmt (iter_init);
finish_expr_stmt (build_x_modify_expr (elocus,
last, NOP_EXPR, decl,
--- gcc/testsuite/g++.dg/gomp/pr67511.C.jj 2015-09-09 12:04:19.830354901 +0200
+++ gcc/testsuite/g++.dg/gomp/pr67511.C 2015-09-09 12:03:55.000000000 +0200
@@ -0,0 +1,20 @@
+// PR c++/67511
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct I
+{
+ I ();
+ I (const I &);
+ I &operator++ ();
+ bool operator< (const I &) const;
+};
+__PTRDIFF_TYPE__ operator- (const I &, const I &);
+
+void
+foo (I &x, I &y)
+{
+#pragma omp for
+ for (I i = x; i < y; ++i) // { dg-error "no match for" }
+ ;
+}
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-10 7:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-10 7:48 [C++ PATCH] Fix OpenMP class iterator error recovery (PR c++/67511) Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).