blob: c2c7548c2215200b88367c3e96a17df4acd481c6 [file] [log] [blame]
Bill Wendlingf6af30f2012-03-16 21:45:12 +00001// RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin %s | FileCheck %s
2// <rdar://problem/11043589>
3
4struct Length {
5 Length(double v) {
6 m_floatValue = static_cast<float>(v);
7 }
8
9 bool operator==(const Length& o) const {
10 return getFloatValue() == o.getFloatValue();
11 }
12 bool operator!=(const Length& o) const { return !(*this == o); }
13private:
14 float getFloatValue() const {
15 return m_floatValue;
16 }
17 float m_floatValue;
18};
19
20
21struct Foo {
22 static Length inchLength(double inch);
23 static bool getPageSizeFromName(const Length &A) {
24 static const Length legalWidth = inchLength(8.5);
25 if (A != legalWidth) return true;
26 return false;
27 }
28};
29
30// CHECK: @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth = linkonce_odr global %struct.Length zeroinitializer, align 4
31// CHECK: store float %call, float* getelementptr inbounds (%struct.Length* @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth, i32 0, i32 0), align 1
32
33bool bar(Length &b) {
34 Foo f;
35 return f.getPageSizeFromName(b);
36}