1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -std=c++11 -O1 -disable-llvm-passes %s -o - | FileCheck %s
4 // CHECK-DAG: define linkonce_odr void @_ZN5test11fIZNS_1gEvE1SEEvT_(
5 template <typename T
> void f(T
) {}
9 return reinterpret_cast<void *>(f
<S
>);
11 void *h() { return g(); }
15 // CHECK-DAG: define internal void @_ZN5test21fIZNS_L1gEvE1SEEvT_(
16 template <typename T
> void f(T
) {}
17 static inline void *g() {
20 return reinterpret_cast<void *>(f
<S
>);
22 void *h() { return g(); }
26 // CHECK-DAG: define internal void @_ZN5test31fIZNS_1gEvE1SEEvT_(
27 template <typename T
> void f(T
) {}
31 return reinterpret_cast<void *>(f
<S
>);
33 void *h() { return g(); }
37 // CHECK-DAG: define linkonce_odr void @_ZN5test41fIZNS_1gILi1EEEPvvE1SEEvT_(
38 template <typename T
> void f(T
) {}
39 template <int N
> inline void *g() {
42 return reinterpret_cast<void *>(f
<S
>);
44 extern template void *g
<1>();
45 template void *g
<1>();
49 // CHECK-DAG: define linkonce_odr void @_ZN5test51fIZNS_1gILi1EEEPvvE1SEEvT_(
50 template <typename T
> void f(T
) {}
51 template <int N
> inline void *g() {
54 return reinterpret_cast<void *>(f
<S
>);
56 extern template void *g
<1>();
57 void *h() { return g
<1>(); }
61 // CHECK-DAG: define linkonce_odr void @_ZN5test61fIZZNS_1gEvEN1S1hEvE1TEEvv(
62 template <typename T
> void f() {}
75 void *h() { return g(); }
79 // CHECK-DAG: define internal void @_ZN5test71fIZZNS_1gEvEN1S1hEvE1TEEvv(
80 template <typename T
> void f() {}
93 void *h() { return g(); }
97 // CHECK-DAG: define linkonce_odr void @_ZN5test81fIZNS_1gEvE1SEEvT_(
98 template <typename T
> void f(T
) {}
102 return reinterpret_cast<void *>(f
<S
>);
104 void *h() { return g(); }
108 // CHECK-DAG: define linkonce_odr void @_ZN5test91fIPZNS_1gEvE1SEEvT_(
109 template <typename T
> void f(T
) {}
113 return reinterpret_cast<void *>(f
<S
*>);
115 void *h() { return g(); }
119 // CHECK-DAG: define linkonce_odr void @_ZN6test101fIPFZNS_1gEvE1SvEEEvT_(
120 template <typename T
> void f(T
) {}
125 return reinterpret_cast<void *>(f
<ftype
>);
127 void *h() { return g(); }
131 // CHECK-DAG: define internal void @_ZN6test111fIPFZNS_1gEvE1SPNS_12_GLOBAL__N_11IEEEEvT_(
137 template <typename T
> void f(T
) {}
141 typedef S(*ftype
)(I
* x
);
142 return reinterpret_cast<void *>(f
<ftype
>);
144 void *h() { return g(); }
148 // CHECK-DAG: define linkonce_odr void @_ZN6test123fooIZNS_3barIZNS_3zedEvE2S2EEPvvE2S1EEvv
149 template <typename T
> void foo() {}
150 template <typename T
> inline void *bar() {
153 return reinterpret_cast<void *>(foo
<S1
>);
158 return reinterpret_cast<void *>(bar
<S2
>);
160 void *h() { return zed(); }
164 // CHECK-DAG: define linkonce_odr void @_ZZN6test133fooEvEN1S3barEv(
169 return (void *)S::bar
;
171 void *zed() { return foo(); }
175 // CHECK-DAG: define linkonce_odr void @_ZN6test143fooIZNS_1fEvE1SE3barILPS1_0EEEvv(
176 template <typename T
> struct foo
{
177 template <T
*P
> static void bar() {}
178 static void *g() { return (void *)bar
<nullptr>; }
189 // CHECK-DAG: define linkonce_odr void @_ZN6test153zedIZNS_3fooIiEEPvvE3barEEvv(
190 template <class T
> void zed() {}
191 template <class T
> void *foo() {
194 return reinterpret_cast<void *>(zed
<bar
>);
196 void test() { foo
<int>(); }
200 // CHECK-DAG: define linkonce_odr void @_ZN6test163zedIZNS_3fooIiE3barEvE1SEEvv(
201 template <class T
> void zed() {}
202 template <class T
> struct foo
{
205 template <class T
> void *foo
<T
>::bar() {
208 return reinterpret_cast<void *>(zed
<S
>);
210 void *test() { return foo
<int>::bar(); }
214 // CHECK-DAG: @_ZZN6test173fooILi42EEEPivE3bar = linkonce_odr
215 // CHECK-DAG: define weak_odr noundef ptr @_ZN6test173fooILi42EEEPiv(
221 template int *foo
<42>();
226 template<template<typename
> class> struct A
{};
227 struct B
{ template<typename
> struct C
; };
229 // CHECK-DAG: define void @_ZN6test181fENS_1AINS_1B1CEEE(