1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck %s
2
3__attribute((objc_root_class)) @interface A @end
4@interface B : A @end
5
6// rdar://problem/23559789
7//   Ensure that type differences don't cause an assert here.
8void test0(__weak B **src) {
9  __weak A *dest = *src;
10}
11// CHECK-LABEL: define void @test0
12// CHECK:       [[SRC:%.*]] = alloca [[B:%.*]]**, align 8
13// CHECK:       [[DEST:%.*]] = alloca [[A:%.*]]*, align 8
14// CHECK:       [[T0:%.*]] = load [[B]]**, [[B]]*** [[SRC]], align 8
15// CHECK-NEXT:  [[T1:%.*]] = bitcast [[B]]** [[T0]] to [[A]]**
16// CHECK-NEXT:  [[T2:%.*]] = bitcast [[A]]** [[DEST]] to i8**
17// CHECK-NEXT:  [[T3:%.*]] = bitcast [[A]]** [[T1]] to i8**
18// CHECK-NEXT:  call void @llvm.objc.copyWeak(i8** [[T2]], i8** [[T3]])
19// CHECK-NEXT:  [[T0:%.*]] = bitcast [[A]]** [[DEST]] to i8**
20// CHECK:       call void @llvm.objc.destroyWeak(i8** [[T0]])
21