| 1 |
// RUN: %clang_cc1 -ast-print %s | FileCheck %s |
| 2 |
namespace N { |
| 3 |
template<typename T, typename U> void f(U); |
| 4 |
template<int> void f(); |
| 5 |
} |
| 6 |
|
| 7 |
void g() { |
| 8 |
// CHECK: N::f<int>(3.14 |
| 9 |
N::f<int>(3.14); |
| 10 |
|
| 11 |
// CHECK: N::f<double> |
| 12 |
void (*fp)(int) = N::f<double>; |
| 13 |
} |
| 14 |
|
| 15 |
|
| 16 |
// (NNS qualified) DeclRefExpr. |
| 17 |
namespace DRE { |
| 18 |
|
| 19 |
template <typename T> |
| 20 |
void foo(); |
| 21 |
|
| 22 |
void test() { |
| 23 |
// CHECK: DRE::foo<int>; |
| 24 |
DRE::foo<int>; |
| 25 |
// CHECK: DRE::template foo<int>; |
| 26 |
DRE::template foo<int>; |
| 27 |
// CHECK: DRE::foo<int>(); |
| 28 |
DRE::foo<int>(); |
| 29 |
// CHECK: DRE::template foo<int>(); |
| 30 |
DRE::template foo<int>(); |
| 31 |
} |
| 32 |
|
| 33 |
} // namespace DRE |
| 34 |
|
| 35 |
|
| 36 |
// MemberExpr. |
| 37 |
namespace ME { |
| 38 |
|
| 39 |
struct S { |
| 40 |
template <typename T> |
| 41 |
void mem(); |
| 42 |
}; |
| 43 |
|
| 44 |
void test() { |
| 45 |
S s; |
| 46 |
// CHECK: s.mem<int>(); |
| 47 |
s.mem<int>(); |
| 48 |
// CHECK: s.template mem<int>(); |
| 49 |
s.template mem<int>(); |
| 50 |
} |
| 51 |
|
| 52 |
} // namespace ME |
| 53 |
|
| 54 |
|
| 55 |
// UnresolvedLookupExpr. |
| 56 |
namespace ULE { |
| 57 |
|
| 58 |
template <typename T> |
| 59 |
int foo(); |
| 60 |
|
| 61 |
template <typename T> |
| 62 |
void test() { |
| 63 |
// CHECK: ULE::foo<T>; |
| 64 |
ULE::foo<T>; |
| 65 |
// CHECK: ULE::template foo<T>; |
| 66 |
ULE::template foo<T>; |
| 67 |
} |
| 68 |
|
| 69 |
} // namespace ULE |
| 70 |
|
| 71 |
|
| 72 |
// UnresolvedMemberExpr. |
| 73 |
namespace UME { |
| 74 |
|
| 75 |
struct S { |
| 76 |
template <typename T> |
| 77 |
void mem(); |
| 78 |
}; |
| 79 |
|
| 80 |
template <typename U> |
| 81 |
void test() { |
| 82 |
S s; |
| 83 |
// CHECK: s.mem<U>(); |
| 84 |
s.mem<U>(); |
| 85 |
// CHECK: s.template mem<U>(); |
| 86 |
s.template mem<U>(); |
| 87 |
} |
| 88 |
|
| 89 |
} // namespace UME |
| 90 |
|
| 91 |
|
| 92 |
// DependentScopeDeclRefExpr. |
| 93 |
namespace DSDRE { |
| 94 |
|
| 95 |
template <typename T> |
| 96 |
struct S; |
| 97 |
|
| 98 |
template <typename T> |
| 99 |
void test() { |
| 100 |
// CHECK: S<T>::foo; |
| 101 |
S<T>::foo; |
| 102 |
// CHECK: S<T>::template foo<>; |
| 103 |
S<T>::template foo<>; |
| 104 |
// CHECK: S<T>::template foo<T>; |
| 105 |
S<T>::template foo<T>; |
| 106 |
} |
| 107 |
|
| 108 |
} // namespace DSDRE |
| 109 |
|
| 110 |
|
| 111 |
// DependentScopeMemberExpr. |
| 112 |
namespace DSME { |
| 113 |
|
| 114 |
template <typename T> |
| 115 |
struct S; |
| 116 |
|
| 117 |
template <typename T> |
| 118 |
void test() { |
| 119 |
S<T> s; |
| 120 |
// CHECK: s.foo; |
| 121 |
s.foo; |
| 122 |
// CHECK: s.template foo<>; |
| 123 |
s.template foo<>; |
| 124 |
// CHECK: s.template foo<T>; |
| 125 |
s.template foo<T>; |
| 126 |
} |
| 127 |
|
| 128 |
} // namespace DSME |