1 // RUN: %clang_cc1 -triple %itanium_abi_triple -Wno-incompatible-function-pointer-types -emit-llvm %s -o - | FileCheck %s
5 int __attribute__((overloadable
)) f(int x
) { return x
; }
6 float __attribute__((overloadable
)) f(float x
) { return x
; }
7 double __attribute__((overloadable
)) f(double x
) { return x
; }
8 double _Complex
__attribute__((overloadable
)) f(double _Complex x
) { return x
; }
9 typedef short v4hi
__attribute__ ((__vector_size__ (8)));
10 v4hi
__attribute__((overloadable
)) f(v4hi x
) { return x
; }
13 void __attribute__((overloadable
)) f(struct X (*ptr
)[10]) { }
15 void __attribute__((overloadable
)) f(int x
, int y
, ...) { }
17 void __attribute__((overloadable
)) f(void (*x
)(void)) {}
33 // Ensuring that we pick the correct function for taking the address of an
34 // overload when conversions are involved.
36 void addrof_many(int *a
) __attribute__((overloadable
, enable_if(0, "")));
37 void addrof_many(void *a
) __attribute__((overloadable
));
38 void addrof_many(char *a
) __attribute__((overloadable
));
40 void addrof_single(int *a
) __attribute__((overloadable
, enable_if(0, "")));
41 void addrof_single(char *a
) __attribute__((overloadable
, enable_if(0, "")));
42 void addrof_single(char *a
) __attribute__((overloadable
));
44 // CHECK-LABEL: define {{(dso_local )?}}void @foo
46 // CHECK: store ptr @_Z11addrof_manyPc
47 void (*p1
)(char *) = &addrof_many
;
48 // CHECK: store ptr @_Z11addrof_manyPv
49 void (*p2
)(void *) = &addrof_many
;
50 // CHECK: ptr @_Z11addrof_manyPc
51 void *vp1
= (void (*)(char *)) & addrof_many
;
52 // CHECK: ptr @_Z11addrof_manyPv
53 void *vp2
= (void (*)(void *)) & addrof_many
;
55 // CHECK: store ptr @_Z13addrof_singlePc
56 void (*p3
)(char *) = &addrof_single
;
57 // CHECK: @_Z13addrof_singlePc
58 void (*p4
)(int *) = &addrof_single
;
59 // CHECK: @_Z13addrof_singlePc
60 void *vp3
= &addrof_single
;
64 void ovl_bar(char *) __attribute__((overloadable
));
65 void ovl_bar(int) __attribute__((overloadable
));
67 // CHECK-LABEL: define {{(dso_local )?}}void @bar
70 unsigned char ucharbuf
[1];
72 // CHECK: call void @_Z7ovl_barPc
74 // CHECK: call void @_Z7ovl_barPc
78 void ovl_baz(int *, int) __attribute__((overloadable
));
79 void ovl_baz(unsigned int *, unsigned int) __attribute__((overloadable
));
80 void ovl_baz2(int, int *) __attribute__((overloadable
));
81 void ovl_baz2(unsigned int, unsigned int *) __attribute__((overloadable
));
82 // CHECK-LABEL: define {{(dso_local )?}}void @baz
85 // Initial rules for incompatible pointer conversions made this overload
87 // CHECK: call void @_Z7ovl_bazPjj
89 // CHECK: call void @_Z7ovl_bazPjj
92 // CHECK: call void @_Z8ovl_baz2jPj
94 // CHECK: call void @_Z8ovl_baz2jPj