The follwoing code snippet triggers an ICE since GCC 4.0.0: ===================================== void foo(int i) { (i ? 1 : 2) = ({ int X; }); } ===================================== bug.cc: In function 'void foo(int)': bug.cc:3: internal compiler error: in build_target_expr_with_type, at cp/tree.c:382 Please submit a full bug report, [etc.] The problem is similar to PR 30158, but alas not fixed with Andrew's patch. It's even worse because it's not an error-recovery bug.
Confirmed.
Subject: Bug 30847 Author: jakub Date: Tue Apr 3 10:08:00 2007 New Revision: 123456 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123456 Log: PR c++/30847 * 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. Added: trunk/gcc/testsuite/g++.dg/parse/cond3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 30847 Author: jakub Date: Tue Apr 3 10:25:31 2007 New Revision: 123461 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123461 Log: PR c++/30847 * 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. Added: branches/gcc-4_2-branch/gcc/testsuite/g++.dg/parse/cond3.C Modified: branches/gcc-4_2-branch/gcc/cp/ChangeLog branches/gcc-4_2-branch/gcc/cp/typeck.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
Subject: Bug 30847 Author: jakub Date: Tue Apr 3 10:28:35 2007 New Revision: 123462 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123462 Log: PR c++/30847 * 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. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/cond3.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/typeck.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Fixed.