<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - False-positive warnings about BOOL conversions in Obj-C with -Wconversion"
   href="http://llvm.org/bugs/show_bug.cgi?id=17208">17208</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False-positive warnings about BOOL conversions in Obj-C with -Wconversion
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>fourdman@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>CLANG_REVISION=188423

Steps: compile the test file (see below)
Expected: no warnings
Actual: 3 false-positive warnings


%
/Volumes/CSTree/foor/chromium/trunk/src/third_party/llvm-build/Release+Asserts/bin/clang
-x objective-c -arch i386 -std=gnu99 -fobjc-arc -Wconversion -iframework
Foundation -fobjc-abi-version=2 -O0 -c test.mm -o test.o
test.mm:17:14: warning: implicit conversion loses integer precision: 'int' to
'BOOL' (aka 'signed char') [-Wconversion]
    self.a = !b;  // Error 1
           ~ ^~
test.mm:21:14: warning: implicit conversion loses integer precision: 'int' to
'BOOL' (aka 'signed char') [-Wconversion]
    self.a = (x == y);  // Error 2
           ~ ^~~~~~~~
test.mm:23:14: warning: implicit conversion loses integer precision: 'int' to
'BOOL' (aka 'signed char') [-Wconversion]
    self.a = (a_ || b);  // Error 3
           ~ ^~~~~~~~~
3 warnings generated.

% cat test.mm
#import <Foundation/Foundation.h>

@interface Foo : NSObject

@property(assign, nonatomic) BOOL a;

- (void)qux;

@end

@implementation Foo

@synthesize a = a_;

- (void)qux {
    BOOL b = NO;
    self.a = !b;  // Error 1

    int x = 5;
    int y = 4;
    self.a = (x == y);  // Error 2

    self.a = (a_ || b);  // Error 3
}

@end</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>