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