xref: /llvm-project/clang/test/SemaObjC/warn-cast-of-sel-expr.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
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
4SEL s;
5
6SEL sel_registerName(const char *);
7
8int 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}
23