1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // Check that IR gen doesn't try to do an lvalue-to-rvalue conversion 4*f4a2713aSLionel Sambuc // on a volatile reference result. rdar://problem/8338198 5*f4a2713aSLionel Sambuc namespace test0 { 6*f4a2713aSLionel Sambuc struct A { 7*f4a2713aSLionel Sambuc A(const A& t); 8*f4a2713aSLionel Sambuc A& operator=(const A& t); 9*f4a2713aSLionel Sambuc volatile A& operator=(const volatile A& t) volatile; 10*f4a2713aSLionel Sambuc }; 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc volatile A *array; 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_ZN5test04testENS_1AE( 15*f4a2713aSLionel Sambuc void test(A t) { 16*f4a2713aSLionel Sambuc // CHECK: [[ARR:%.*]] = load [[A:%.*]]** @_ZN5test05arrayE, align 8 17*f4a2713aSLionel Sambuc // CHECK-NEXT: [[IDX:%.*]] = getelementptr inbounds [[A]]* [[ARR]], i64 0 18*f4a2713aSLionel Sambuc // CHECK-NEXT: [[TMP:%.*]] = call [[A]]* @_ZNV5test01AaSERVKS0_([[A]]* [[IDX]], [[A]]* [[T:%.*]]) 19*f4a2713aSLionel Sambuc // CHECK-NEXT: ret void 20*f4a2713aSLionel Sambuc array[0] = t; 21*f4a2713aSLionel Sambuc } 22*f4a2713aSLionel Sambuc } 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc namespace test1 { 25*f4a2713aSLionel Sambuc volatile int *x; 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_ZN5test14testEv() 28*f4a2713aSLionel Sambuc void test() { 29*f4a2713aSLionel Sambuc // CHECK: [[TMP:%.*]] = load i32** @_ZN5test11xE, align 8 30*f4a2713aSLionel Sambuc // CHECK-NEXT: ret void 31*f4a2713aSLionel Sambuc *x; 32*f4a2713aSLionel Sambuc } 33*f4a2713aSLionel Sambuc } 34