1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \
3 // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \
6 extern "C" int printf(...);
8 int f1(int arg
) { return arg
; };
10 int f2(float arg
) { return int(arg
); };
12 typedef int (*fp1
)(int);
14 typedef int (*fp2
)(float);
17 operator fp1() { return f1
; }
18 operator fp2() { return f2
; }
22 // Test for function reference.
23 typedef int (&fr1
)(int);
24 typedef int (&fr2
)(float);
27 operator fr1() { return f1
; }
28 operator fr2() { return f2
; }
33 int i
= a(10); // Calls f1 via pointer returned from conversion function
34 printf("i = %d\n", i
);
36 int j
= b(20); // Calls f1 via pointer returned from conversion function
37 printf("j = %d\n", j
);
41 // CHECK: call noundef ptr @_ZN1AcvPFiiEEv
42 // CHECK: call noundef nonnull ptr @_ZN1BcvRFiiEEv