#include <stdio.h> int main() { int array[2]; bool boolval = true;
array[0] = 3; array[1] = 7; int total; total= array[0] + boolval ? array[1] : 0; printf("with boolval true, total = %d\n",total); boolval = false; total= array[0] + boolval ? array[1] : 0; printf("with boolval false, total = %d\n",total); total = 3 + boolval ? 7 : 0; printf("with ints, total = %d\n",total); return 0; } gives with boolval true, total = 7 with boolval false, total = 7 with ints, total = 7 Using brackets gives correct results. -- Summary: addition using lambda expression gives wrong results Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cbruner at quadro dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27145