summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC/warn-cast-of-sel-expr.m
blob: 97915a0094ef33a572a6fef15dea2bec10d66cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %clang_cc1  -fsyntax-only -verify -Wno-unused-value %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wcast-of-sel-type -Wno-unused-value %s
// rdar://12107381

SEL s;

SEL sel_registerName(const char *);

int main() {
(char *)s;  // expected-warning {{cast of type 'SEL' to 'char *' is deprecated; use sel_getName instead}}
(void *)s;  // ok
(const char *)sel_registerName("foo");  // expected-warning {{cast of type 'SEL' to 'const char *' is deprecated; use sel_getName instead}}

(const void *)sel_registerName("foo");  // ok

(void) s;   // ok

(void *const)s; // ok

(const void *const)s; // ok
}
OpenPOWER on IntegriCloud