xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/warn-cast-of-sel-expr.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -verify -Wno-unused-value %s
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wcast-of-sel-type -Wno-unused-value %s
3*f4a2713aSLionel Sambuc// rdar://12107381
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel SambucSEL s;
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel SambucSEL sel_registerName(const char *);
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambucint main() {
10*f4a2713aSLionel Sambuc(char *)s;  // expected-warning {{cast of type 'SEL' to 'char *' is deprecated; use sel_getName instead}}
11*f4a2713aSLionel Sambuc(void *)s;  // ok
12*f4a2713aSLionel Sambuc(const char *)sel_registerName("foo");  // expected-warning {{cast of type 'SEL' to 'const char *' is deprecated; use sel_getName instead}}
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc(const void *)sel_registerName("foo");  // ok
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc(void) s;   // ok
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc(void *const)s; // ok
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc(const void *const)s; // ok
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc// rdar://12859590
23*f4a2713aSLionel Sambuc(SEL)sel_registerName("foo");  // ok
24*f4a2713aSLionel Sambuc}
25