brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 44a3355 Raw
129 lines · cpp
1// RUN: %clang_cc1 -ast-print %s | FileCheck %s2namespace N {3  template<typename T, typename U> void f(U);4  template<int> void f();5}6 7void g() {8  // CHECK: N::f<int>(3.149  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.17namespace DRE {18 19template <typename T>20void foo();21 22void 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 DRE34 35 36// MemberExpr.37namespace ME {38 39struct S {40  template <typename T>41  void mem();42};43 44void 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 ME53 54 55// UnresolvedLookupExpr.56namespace ULE {57 58template <typename T>59int foo();60 61template <typename T>62void 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 ULE70 71 72// UnresolvedMemberExpr.73namespace UME {74 75struct S {76  template <typename T>77  void mem();78};79 80template <typename U>81void 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 UME90 91 92// DependentScopeDeclRefExpr.93namespace DSDRE {94 95template <typename T>96struct S;97 98template <typename T>99void 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 DSDRE109 110 111// DependentScopeMemberExpr.112namespace DSME {113 114template <typename T>115struct S;116 117template <typename T>118void 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 DSME129