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