PR c++/17661
* testsuite/g++.dg/expr/for2.C: New test.
2004-10-13 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17661
* semantics.c (finish_for_expr): Convert expression to void
so that we don't create temporaries for a?b:c.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88992
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-10-13 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c++/17661
+ * semantics.c (finish_for_expr): Convert expression to void
+ so that we don't create temporaries for a?b:c.
+
2004-10-13 Kazu Hirata <kazu@cs.umass.edu>
* search.c: Fix a comment typo.
cxx_incomplete_type_error (expr, TREE_TYPE (expr));
expr = error_mark_node;
}
+ if (!processing_template_decl)
+ {
+ if (warn_sequence_point)
+ verify_sequence_points (expr);
+ expr = convert_to_void (expr, "3rd expression in for");
+ }
+ else if (!type_dependent_expression_p (expr))
+ convert_to_void (build_non_dependent_expr (expr), "3rd expression in for");
expr = maybe_cleanup_point_expr_void (expr);
FOR_EXPR (for_stmt) = expr;
}
+2004-10-13 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR c++/17661
+ * testsuite/g++.dg/expr/for2.C: New test.
+
2004-10-13 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/inherit/thunk1.C: Run on the SPARC.
--- /dev/null
+// { dg-do compile }
+// PR c++/17661
+// We used to try to create a temprary for the condition
+// expression in the for which was wrong.
+
+
+struct C
+{
+ C (const C &x);
+};
+C &f();
+void breakme (C j, bool k)
+{
+ for (;; k ? j : f()) ;
+}