]> granicus.if.org Git - clang/commitdiff
Test to ensure no old-style-cast warning is emitted for objc-arc __bridge casts
authorAlp Toker <alp@nuanti.com>
Tue, 3 Dec 2013 05:31:51 +0000 (05:31 +0000)
committerAlp Toker <alp@nuanti.com>
Tue, 3 Dec 2013 05:31:51 +0000 (05:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196204 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaObjCXX/old-style-cast.mm [new file with mode: 0644]

diff --git a/test/SemaObjCXX/old-style-cast.mm b/test/SemaObjCXX/old-style-cast.mm
new file mode 100644 (file)
index 0000000..5dbac09
--- /dev/null
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -Wold-style-cast -verify %s
+// expected-no-diagnostics
+
+// We don't currently have a way to write ARC/C++ bridge casts in terms of C++
+// casts, so ensure we don't emit an old-style-cast warning in these cases.
+
+id test(void *opaqueInput) {
+  id someObjCObject = (__bridge id)opaqueInput;
+  void *someCFObject = (__bridge_retained void *)someObjCObject;
+  return (__bridge_transfer id)someCFObject;
+}