http://llvm.org/bugs/show_bug.cgi?id=9056

           Summary: -Wuninitialized false positive with foreach objc
                    construct.
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Created an attachment (id=6051)
 --> (http://llvm.org/bugs/attachment.cgi?id=6051)
Test case

The recent merge of -Wuninitialized-experimental with -Wuninitialized
introduces a very annoying false positive.

When using the "for in" objc syntax, clang emits a warning.

------------ foreach.m
void test() {
  id collection = 0;
  for (id obj in collection) {
    if (0 == obj)
      break;
  }
}
------------
clang -fsyntax-only -Wuninitialized foreach.m
foreach.m:4:8: warning: use of uninitialized variable 'obj' [-Wuninitialized]
  for (id obj in collection) {
       ^~~~~~
foreach.m:5:11: note: variable 'obj' is possibly uninitialized when used here
        if (0 == obj)
                 ^~~
foreach.m:4:14: note: add initialization to silence this warning
  for (id obj in collection) {
             ^
              = 0
1 warning generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to