1 // RUN: %clang_cc1 -fblocks -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
3 template<typename Signature
>
8 typedef C
<void(void)> C0
;
10 template<typename Ret
, typename Arg1
>
11 class C
<Ret(Arg1
)> {};
13 template<typename Ret
, typename Arg1
, typename Arg2
>
14 class C
<Ret(Arg1
, Arg2
)> {};
17 // CHECK: "?callback_void@@3V?$C@$$A6AXXZ@@A"
19 volatile C0 callback_void_volatile
;
20 // CHECK: "?callback_void_volatile@@3V?$C@$$A6AXXZ@@C"
24 C
<int(void)> callback_int
;
25 // CHECK: "?callback_int@@3V?$C@$$A6AHXZ@@A"
26 C
<Type(void)> callback_Type
;
27 // CHECK: "?callback_Type@@3V?$C@$$A6A?AVType@@XZ@@A"
29 C
<void(int)> callback_void_int
;
30 // CHECK: "?callback_void_int@@3V?$C@$$A6AXH@Z@@A"
31 C
<int(int)> callback_int_int
;
32 // CHECK: "?callback_int_int@@3V?$C@$$A6AHH@Z@@A"
33 C
<void(Type
)> callback_void_Type
;
34 // CHECK: "?callback_void_Type@@3V?$C@$$A6AXVType@@@Z@@A"
37 // CHECK: "?foo@@YAXV?$C@$$A6AXXZ@@@Z"
40 // Let's face the magic of template partial specialization...
42 void function(C
<void(void)>) {}
43 // CHECK: "?function@@YAXV?$C@$$A6AXXZ@@@Z"
45 template<typename Ret
> class C
<Ret(*)(void)> {};
46 void function_pointer(C
<void(*)(void)>) {}
47 // CHECK: "?function_pointer@@YAXV?$C@P6AXXZ@@@Z"
49 // Block equivalent to the previous definitions.
50 template<typename Ret
> class C
<Ret(^)(void)> {};
51 void block(C
<void(^)(void)>) {}
52 // CHECK: "?block@@YAXV?$C@P_EAXXZ@@@Z"
53 // FYI blocks are not present in MSVS, so we're free to choose the spec.
55 template<typename T
> class C
<void (T::*)(void)> {};
60 void member_pointer(C
<void (Z::*)(void)>) {}
61 // CHECK: "?member_pointer@@YAXV?$C@P8Z@@AEXXZ@@@Z"
63 template<typename T
> void bar(T
) {}
67 // CHECK: "??$bar@P6AHH@Z@@YAXP6AHH@Z@Z"
70 // CHECK: "??$bar@P_EAHH@Z@@YAXP_EAHH@Z@Z"
71 // FYI blocks are not present in MSVS, so we're free to choose the spec.
74 template <void (*Fn
)()> void WrapFnPtr() { Fn(); }
75 template <void (&Fn
)()> void WrapFnRef() { Fn(); }
77 static void VoidStaticMethod();
83 WrapFnPtr
<Thing::VoidStaticMethod
>();
84 WrapFnRef
<Thing::VoidStaticMethod
>();
86 // CHECK: call {{.*}} @"??$WrapFnPtr@$1?VoidFn@@YAXXZ@@YAXXZ"
87 // CHECK: call {{.*}} @"??$WrapFnRef@$1?VoidFn@@YAXXZ@@YAXXZ"
88 // CHECK: call {{.*}} @"??$WrapFnPtr@$1?VoidStaticMethod@Thing@@SAXXZ@@YAXXZ"
89 // CHECK: call {{.*}} @"??$WrapFnRef@$1?VoidStaticMethod@Thing@@SAXXZ@@YAXXZ"