Skip to content

-Wuninitialized false positive with foreach objc construct. #9428

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 9056
Resolution FIXED
Resolved on Jan 26, 2011 20:02
Version trunk
OS All
Attachments Test case
Reporter LLVM Bugzilla Contributor
CC @tkremenek,@nico

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions