xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/self-assign.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc@interface A
3*f4a2713aSLionel Sambuc@end
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@implementation A
6*f4a2713aSLionel Sambuc- (id):(int)x :(int)y {
7*f4a2713aSLionel Sambuc    int z;
8*f4a2713aSLionel Sambuc    // <rdar://problem/8939352>
9*f4a2713aSLionel Sambuc    if (self = [self :x :y]) {} // expected-warning{{using the result of an assignment as a condition without parentheses}} \
10*f4a2713aSLionel Sambuc    // expected-note{{use '==' to turn this assignment into an equality comparison}} \
11*f4a2713aSLionel Sambuc    // expected-note{{place parentheses around the assignment to silence this warning}}
12*f4a2713aSLionel Sambuc    return self;
13*f4a2713aSLionel Sambuc}
14*f4a2713aSLionel Sambuc@end
15