* typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void
type issue error and return early.
* g++.dg/parse/cond3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123456
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/30847
+ * typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void
+ type issue error and return early.
+
2007-03-30 Jason Merrill <jason@redhat.com>
PR c++/31187
2007-03-30 Jason Merrill <jason@redhat.com>
PR c++/31187
tree cond;
tree preeval = NULL_TREE;
tree cond;
tree preeval = NULL_TREE;
+ if (VOID_TYPE_P (TREE_TYPE (rhs)))
+ {
+ error ("void value not ignored as it ought to be");
+ return error_mark_node;
+ }
+
rhs = stabilize_expr (rhs, &preeval);
/* Check this here to avoid odd errors when trying to convert
rhs = stabilize_expr (rhs, &preeval);
/* Check this here to avoid odd errors when trying to convert
2007-04-03 Jakub Jelinek <jakub@redhat.com>
2007-04-03 Jakub Jelinek <jakub@redhat.com>
+ PR c++/30847
+ * g++.dg/parse/cond3.C: New test.
+
PR middle-end/30704
* gcc.c-torture/execute/ieee/pr30704.c: New test.
PR middle-end/30704
* gcc.c-torture/execute/ieee/pr30704.c: New test.
--- /dev/null
+// PR c++/30847
+// { dg-do compile }
+// { dg-options "" }
+
+int j, k, l;
+extern void baz ();
+
+void
+foo (int i)
+{
+ (i ? j : k) = ({ l++; (void) l; }); // { dg-error "void value not ignored" }
+ (i ? j : k) += ({ l++; (void) l; }); // { dg-error "void value not ignored" }
+ (i ? j : k) = baz (); // { dg-error "void value not ignored" }
+ (i ? j : k) *= baz (); // { dg-error "void value not ignored" }
+}