This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/27145] New: addition using lambda expression gives wrong results
- From: "cbruner at quadro dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Apr 2006 15:32:12 -0000
- Subject: [Bug c++/27145] New: addition using lambda expression gives wrong results
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
#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