[cfe-commits] r164143 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaChecking.cpp test/Analysis/additive-folding.cpp test/Sema/compare.c test/Sema/outof-range-constant-compare.c test/SemaCXX/compare.cpp test/SemaCXX/for-range-examples.cpp test/SemaCXX/warn-enum-compare.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Sep 18 17:56:42 PDT 2012


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 <fjahanian at apple.com> 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));
>> }
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120918/974aad71/attachment.html>


More information about the cfe-commits mailing list