1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck -strict-whitespace %s
2 
3 // Tests to verify we construct correct using template names.
4 // TemplateNames are not dumped, so the sugar here isn't obvious. However
5 // the "using" on the TemplateSpecializationTypes shows that the
6 // UsingTemplateName is present.
7 namespace ns {
8 template<typename T> class S {
9  public:
10    S(T);
11 };
12 }
13 using ns::S;
14 
15 // TemplateName in TemplateSpecializationType.
16 template<typename T>
17 using A = S<T>;
18 // CHECK:      TypeAliasDecl
19 // CHECK-NEXT: `-ElaboratedType {{.*}} 'S<T>' sugar dependent
20 // CHECK-NEXT:   `-TemplateSpecializationType {{.*}} 'S<T>' dependent using S
21 
22 // TemplateName in TemplateArgument.
23 template <template <typename> class T> class X {};
24 using B = X<S>;
25 // CHECK:      TypeAliasDecl
26 // CHECK-NEXT: `-ElaboratedType {{.*}} 'X<ns::S>' sugar
27 // CHECK-NEXT:   `-TemplateSpecializationType {{.*}} 'X<ns::S>' sugar X
28 // CHECK-NEXT:     |-TemplateArgument using template S
29 // CHECK-NEXT:       `-RecordType {{.*}} 'X<ns::S>'
30 // CHECK-NEXT:         `-ClassTemplateSpecialization {{.*}} 'X'
31 
32 // TemplateName in DeducedTemplateSpecializationType.
33 S DeducedTemplateSpecializationT(123);
34 using C = decltype(DeducedTemplateSpecializationT);
35 // CHECK:      DecltypeType {{.*}}
36 // CHECK-NEXT:  |-DeclRefExpr {{.*}}
37 // CHECK-NEXT:  `-ElaboratedType {{.*}} 'S<int>' sugar
38 // CHECK-NEXT:    `-DeducedTemplateSpecializationType {{.*}} 'ns::S<int>' sugar using
39