1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -std=c++11 -o - %s | FileCheck %s
3 __attribute((objc_root_class)) @interface A @end
6 // rdar://problem/23559789
7 // Ensure that type differences don't cause an assert here.
8 void test0(__weak B **src) {
11 // CHECK-LABEL: define{{.*}} void @_Z5test0PU6__weakP1B(
12 // CHECK: [[SRC:%.*]] = alloca ptr, align 8
13 // CHECK: [[DEST:%.*]] = alloca ptr, align 8
14 // CHECK: [[T0:%.*]] = load ptr, ptr [[SRC]], align 8
15 // CHECK-NEXT: call void @llvm.objc.copyWeak(ptr [[DEST]], ptr [[T0]])
16 // CHECK: call void @llvm.objc.destroyWeak(ptr [[DEST]])
18 void test1(__weak B **src) {
19 __weak A *dest = static_cast<__weak B*&&>(*src);
21 // CHECK-LABEL: define{{.*}} void @_Z5test1PU6__weakP1B(
22 // CHECK: [[SRC:%.*]] = alloca ptr, align 8
23 // CHECK: [[DEST:%.*]] = alloca ptr, align 8
24 // CHECK: [[T0:%.*]] = load ptr, ptr [[SRC]], align 8
25 // CHECK-NEXT: call void @llvm.objc.moveWeak(ptr [[DEST]], ptr [[T0]])
26 // CHECK: call void @llvm.objc.destroyWeak(ptr [[DEST]])