1*67e74705SXin Li // RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin %s | FileCheck %s 2*67e74705SXin Li // <rdar://problem/11043589> 3*67e74705SXin Li 4*67e74705SXin Li struct Length { LengthLength5*67e74705SXin Li Length(double v) { 6*67e74705SXin Li m_floatValue = static_cast<float>(v); 7*67e74705SXin Li } 8*67e74705SXin Li operator ==Length9*67e74705SXin Li bool operator==(const Length& o) const { 10*67e74705SXin Li return getFloatValue() == o.getFloatValue(); 11*67e74705SXin Li } operator !=Length12*67e74705SXin Li bool operator!=(const Length& o) const { return !(*this == o); } 13*67e74705SXin Li private: getFloatValueLength14*67e74705SXin Li float getFloatValue() const { 15*67e74705SXin Li return m_floatValue; 16*67e74705SXin Li } 17*67e74705SXin Li float m_floatValue; 18*67e74705SXin Li }; 19*67e74705SXin Li 20*67e74705SXin Li 21*67e74705SXin Li struct Foo { 22*67e74705SXin Li static Length inchLength(double inch); getPageSizeFromNameFoo23*67e74705SXin Li static bool getPageSizeFromName(const Length &A) { 24*67e74705SXin Li static const Length legalWidth = inchLength(8.5); 25*67e74705SXin Li if (A != legalWidth) return true; 26*67e74705SXin Li return false; 27*67e74705SXin Li } 28*67e74705SXin Li }; 29*67e74705SXin Li 30*67e74705SXin Li // CHECK: @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth = linkonce_odr global %struct.Length zeroinitializer, align 4 31*67e74705SXin Li // CHECK: store float %{{.*}}, float* getelementptr inbounds (%struct.Length, %struct.Length* @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth, i32 0, i32 0), align 4 32*67e74705SXin Li bar(Length & b)33*67e74705SXin Libool bar(Length &b) { 34*67e74705SXin Li Foo f; 35*67e74705SXin Li return f.getPageSizeFromName(b); 36*67e74705SXin Li } 37