On Sep 18, 2012, at 3:27 PM, Jordan Rose wrote:

> Just curious: were these unparenthesized actually causing failures for you?

Yes, it was giving me the warning:
comparison of literal 10 with expression of type 'bool' is always false

This is because it is expanded into:
if (!total == 10) { return 1; };

In c++, (but not in c), comparing a bool to 10.

- Fariborz

> 
> 
> On Sep 18, 2012, at 10:37 , Fariborz Jahanian <[email protected]> wrote:
> 
>> Modified: cfe/trunk/test/SemaCXX/for-range-examples.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/for-range-examples.cpp?rev=164143&r1=164142&r2=164143&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/SemaCXX/for-range-examples.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/for-range-examples.cpp Tue Sep 18 12:37:21 2012
>> @@ -122,12 +122,12 @@
>>   for (auto n : range(1, 5)) {
>>     total += n;
>>   }
>> -  assert(total == 10);
>> +  assert((total == 10));
>> 
>>   for (auto n : range(10, 100, 10)) {
>>     total += n;
>>   }
>> -  assert(total == 460);
>> +  assert((total == 460));
>> 
>>   map_range::vector<char> chars;
>>   chars.push_back('a');
>> @@ -136,7 +136,7 @@
>>   for (char c : chars) {
>>     ++total;
>>   }
>> -  assert(total == 463);
>> +  assert((total == 463));
>> 
>>   typedef map_range::tuple<int, double> T;
>>   map_range::vector<T> pairs;
>> @@ -146,7 +146,7 @@
>>   for (auto a : map(map_range::mem_fun(&T::get<int>), pairs)) {
>>     total += a;
>>   }
>> -  assert(total == 500);
>> +  assert((total == 500));
>> }
> 

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to