xref: /llvm-project/clang/test/SemaObjCXX/debugger-cast-result-to-id.mm (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -std=c++11 -fdebugger-support -fdebugger-cast-result-to-id -funknown-anytype -fsyntax-only -verify %s
2
3extern __unknown_anytype test0a;
4extern __unknown_anytype test1a();
5extern __unknown_anytype test0b;
6extern __unknown_anytype test1b();
7extern __unknown_anytype test0c;
8extern __unknown_anytype test1c();
9extern __unknown_anytype test0d;
10extern __unknown_anytype test1d();
11extern __unknown_anytype test0d;
12extern __unknown_anytype test1d();
13
14@interface A
15@end
16
17namespace rdar9416370 {
18  void test(id x) {
19    if ([x foo]) {} // expected-error {{no known method '-foo'; cast the message send to the method's return type}}
20    [x foo];
21  }
22}
23
24@class NSString; // expected-note {{forward declaration of class here}}
25namespace rdar10988847 {
26  void test() {
27    id s = [NSString stringWithUTF8String:"foo"]; // expected-warning {{receiver 'NSString' is a forward class and corresponding @interface may not exist}}
28  }
29}
30
31namespace rdar13338107 {
32  void test() {
33    id x1 = test0a;
34    id x2 = test1a();
35    A *x3 = test0b;
36    A *x4 = test1b();
37    auto x5 = test0c;
38    auto x6 = test1c();
39  }
40}
41