1 | // RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin %s | FileCheck %s |
2 | // <rdar://problem/11043589> |
3 | |
4 | struct 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); } |
13 | private: |
14 | float getFloatValue() const { |
15 | return m_floatValue; |
16 | } |
17 | float m_floatValue; |
18 | }; |
19 | |
20 | |
21 | struct 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 %{{.*}}, float* getelementptr inbounds (%struct.Length, %struct.Length* @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth, i32 0, i32 0), align 4 |
32 | |
33 | bool bar(Length &b) { |
34 | Foo f; |
35 | return f.getPageSizeFromName(b); |
36 | } |
37 | |