1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck -strict-whitespace %s
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.
8 template<typename T
> class S
{
12 template<typename T
> struct S2
{ S2(T
); };
13 template <typename T
> S2(T t
) -> S2
<T
>;
18 // TemplateName in TemplateSpecializationType.
21 // CHECK: TypeAliasDecl
22 // CHECK-NEXT: `-ElaboratedType {{.*}} 'S<T>' sugar dependent
23 // CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'S<T>' dependent using S
25 // TemplateName in TemplateArgument.
26 template <template <typename
> class T
> class X
{};
28 // CHECK: TypeAliasDecl
29 // CHECK-NEXT: `-ElaboratedType {{.*}} 'X<ns::S>' sugar
30 // CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'X<ns::S>' sugar X
31 // CHECK-NEXT: |-TemplateArgument using template S
32 // CHECK-NEXT: `-RecordType {{.*}} 'X<ns::S>'
33 // CHECK-NEXT: `-ClassTemplateSpecialization {{.*}} 'X'
35 // TemplateName in DeducedTemplateSpecializationType.
36 S
DeducedTemplateSpecializationT(123);
37 using C
= decltype(DeducedTemplateSpecializationT
);
38 // CHECK: DecltypeType {{.*}}
39 // CHECK-NEXT: |-DeclRefExpr {{.*}}
40 // CHECK-NEXT: `-ElaboratedType {{.*}} 'S<int>' sugar
41 // CHECK-NEXT: `-DeducedTemplateSpecializationType {{.*}} 'ns::S<int>' sugar using
43 S2
DeducedTemplateSpecializationT2(123);
44 using D
= decltype(DeducedTemplateSpecializationT2
);
45 // CHECK: DecltypeType {{.*}}
46 // CHECK-NEXT: |-DeclRefExpr {{.*}}
47 // CHECK-NEXT: `-ElaboratedType {{.*}} 'S2<int>' sugar
48 // CHECK-NEXT: `-DeducedTemplateSpecializationType {{.*}} 'S2<int>' sugar using