xref: /aosp_15_r20/external/clang/test/SemaObjC/property-11.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li// expected-no-diagnostics
3*67e74705SXin Li
4*67e74705SXin Li@interface NSSound
5*67e74705SXin Li@end
6*67e74705SXin Li@interface NSFont
7*67e74705SXin Li@end
8*67e74705SXin Li
9*67e74705SXin Li@interface NSSound (Adds)
10*67e74705SXin Li@end
11*67e74705SXin Li
12*67e74705SXin Li@implementation NSSound (Adds)
13*67e74705SXin Li- foo {
14*67e74705SXin Li  return self;
15*67e74705SXin Li}
16*67e74705SXin Li- (void)setFoo:obj {
17*67e74705SXin Li}
18*67e74705SXin Li@end
19*67e74705SXin Li
20*67e74705SXin Li@implementation NSFont (Adds)
21*67e74705SXin Li
22*67e74705SXin Li- xx {
23*67e74705SXin Li  NSSound *x;
24*67e74705SXin Li  id o;
25*67e74705SXin Li
26*67e74705SXin Li  // GCC does *not* warn about the following. Since foo/setFoo: are not in the
27*67e74705SXin Li  // class or category interface for NSSound, the compiler shouldn't find them.
28*67e74705SXin Li  // For now, we will support GCC's behavior (sigh).
29*67e74705SXin Li  o = [x foo];
30*67e74705SXin Li  o = x.foo;
31*67e74705SXin Li  [x setFoo:o];
32*67e74705SXin Li  x.foo = o;
33*67e74705SXin Li  return 0;
34*67e74705SXin Li}
35*67e74705SXin Li
36*67e74705SXin Li@end
37*67e74705SXin Li
38