http://llvm.org/bugs/show_bug.cgi?id=14607
Bug #: 14607
Summary: clang does not emit a warning when assigning
properties in conditions
Product: clang
Version: 3.2
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
clang emits a nice warning when assigning in an condition:
"using the result of an assignment as a condition without parentheses"
however, this is only true for normal/member variables and direct property
access, not when accessing properties with dot notation:
@interface Test : NSObject
@property (assign, nonatomic) BOOL cond;
@end
@implementation Test
- (void)bugWithWarning
{// clang properly warns here "using the result of an assignment as a condition
without parentheses"
if (_cond = YES)
NSLog(@"condition true");
}
- (void)bugWithoutWarning
{ // clang fails to warn here even with -Weverything. another bug gone
unnoticed.
if (self.cond = YES)
NSLog(@"condition true");
}
@end
--
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