Debian Codegraph @

clang/test/SemaObjC/warn-cast-of-sel-expr.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value %s
2 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wcast-of-sel-type -Wno-unused-value %s
3
4 SEL s;
5
6 SEL sel_registerName(const char *);
7
8 int main(void) {
9 (char *)s; // expected-warning {{cast of type 'SEL' to 'char *' is deprecated; use sel_getName instead}}
10 (void *)s; // ok
11 (const char *)sel_registerName("foo"); // expected-warning {{cast of type 'SEL' to 'const char *' is deprecated; use sel_getName instead}}
12
13 (const void *)sel_registerName("foo"); // ok
14
15 (void) s; // ok
16
17 (void *const)s; // ok
18
19 (const void *const)s; // ok
20
21 (SEL)sel_registerName("foo"); // ok
22 }