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