xref: /aosp_15_r20/external/clang/test/SemaObjC/receiver-forward-class.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -Wreceiver-forward-class -verify %s
2*67e74705SXin Li// RUN: %clang_cc1 -x objective-c++ -fsyntax-only  -Wreceiver-forward-class -verify %s
3*67e74705SXin Li// rdar://10686120
4*67e74705SXin Li
5*67e74705SXin Li@class A; // expected-note {{forward declaration of class here}}
6*67e74705SXin Li
7*67e74705SXin Li@interface B
8*67e74705SXin Li-(int) width; // expected-note {{using}}
9*67e74705SXin Li@end
10*67e74705SXin Li@interface C
11*67e74705SXin Li-(float) width; // expected-note {{also found}}
12*67e74705SXin Li@end
13*67e74705SXin Li
14*67e74705SXin Liint f0(A *x) {
15*67e74705SXin Li  return [x width]; // expected-warning {{receiver type 'A' for instance message is a forward declaration}} \
16*67e74705SXin Li                    // expected-warning {{multiple methods named 'width' found}} \
17*67e74705SXin Li                    // expected-note {{receiver is treated with 'id' type for purpose of method lookup}}
18*67e74705SXin Li}
19*67e74705SXin Li
20