Fariborz Jahanian | ca7a7be | 2012-08-16 20:16:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value %s |
Fariborz Jahanian | 91dd9df | 2012-08-16 18:33:47 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wcast-of-sel-type -Wno-unused-value %s |
| 3 | // rdar://12107381 |
| 4 | |
| 5 | SEL s; |
| 6 | |
| 7 | SEL sel_registerName(const char *); |
| 8 | |
| 9 | int main() { |
| 10 | (char *)s; // expected-warning {{cast of type 'SEL' to 'char *' is deprecated; use sel_getName instead}} |
| 11 | (void *)s; // ok |
| 12 | (const char *)sel_registerName("foo"); // expected-warning {{cast of type 'SEL' to 'const char *' is deprecated; use sel_getName instead}} |
| 13 | |
| 14 | (const void *)sel_registerName("foo"); // ok |
| 15 | |
| 16 | (void) s; // ok |
| 17 | |
| 18 | (void *const)s; // ok |
| 19 | |
| 20 | (const void *const)s; // ok |
Fariborz Jahanian | 0c252fa | 2012-12-13 00:42:06 +0000 | [diff] [blame^] | 21 | |
| 22 | // rdar://12859590 |
| 23 | (SEL)sel_registerName("foo"); // ok |
Fariborz Jahanian | 91dd9df | 2012-08-16 18:33:47 +0000 | [diff] [blame] | 24 | } |