aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-08-19 10:33:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-08-19 10:33:04 +0000
commit657bc3d9848e3be92029b2416031340988cd0111 (patch)
tree5b9c2fa9d79942fbdce3d618e37e27c18263af9a /test/SemaObjC
parent56d91b49b13fe55c918afbda19f6165b5fbff87a (diff)
Notes
Diffstat (limited to 'test/SemaObjC')
-rw-r--r--test/SemaObjC/warn-cast-of-sel-expr.m21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/SemaObjC/warn-cast-of-sel-expr.m b/test/SemaObjC/warn-cast-of-sel-expr.m
new file mode 100644
index 0000000000000..97915a0094ef3
--- /dev/null
+++ b/test/SemaObjC/warn-cast-of-sel-expr.m
@@ -0,0 +1,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
+}