[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / SemaTemplate / make_integer_seq.cpp
blob71e34c5e0e7dfd72920c2a199f4d8b162c87e024
1 // RUN: %clang_cc1 -std=c++23 -triple x86_64-linux-gnu -ast-dump -verify -xc++ < %s | FileCheck %s
3 template <class A1, A1... A2> struct A {};
5 using test1 = __make_integer_seq<A, int, 1>;
6 // CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}} <line:5:1, col:43> col:7 test1 '__make_integer_seq<A, int, 1>':'A<int, 0>'
7 // CHECK-NEXT: `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, int, 1>' sugar
8 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, int, 1>' sugar alias
9 // CHECK-NEXT: |-name: '__make_integer_seq' qualified
10 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
11 // CHECK-NEXT: |-TemplateArgument template 'A'
12 // CHECK-NEXT: | `-ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:1, col:41> col:38 A
13 // CHECK-NEXT: |-TemplateArgument type 'int'
14 // CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
15 // CHECK-NEXT: |-TemplateArgument expr '1'
16 // CHECK-NEXT: | `-ConstantExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:42> 'int'
17 // CHECK-NEXT: | |-value: Int 1
18 // CHECK-NEXT: | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}} <col:42> 'int' 1
19 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} 'A<int, 0>' sugar
20 // CHECK-NEXT: |-name: 'A' qualified
21 // CHECK-NEXT: | `-ClassTemplateDecl {{.+}} A
22 // CHECK-NEXT: |-TemplateArgument type 'int'
23 // CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
24 // CHECK-NEXT: |-TemplateArgument expr '0'
25 // CHECK-NEXT: | `-ConstantExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:42> 'int'
26 // CHECK-NEXT: | |-value: Int 0
27 // CHECK-NEXT: | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}} <col:42> 'int' 0
28 // CHECK-NEXT: `-RecordType 0x{{[0-9A-Fa-f]+}} 'A<int, 0>'
29 // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{[0-9A-Fa-f]+}} 'A'
31 template <class B1, B1 B2> using B = __make_integer_seq<A, B1, B2>;
32 using test2 = B<int, 1>;
33 // CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:1, col:23> col:7 test2 'B<int, 1>':'A<int, 0>'
34 // CHECK-NEXT: `-ElaboratedType 0x{{[0-9A-Fa-f]+}} 'B<int, 1>' sugar
35 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} 'B<int, 1>' sugar alias
36 // CHECK-NEXT: |-name: 'B' qualified
37 // CHECK-NEXT: | `-TypeAliasTemplateDecl {{.+}} B
38 // CHECK-NEXT: |-TemplateArgument type 'int'
39 // CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
40 // CHECK-NEXT: |-TemplateArgument expr '1'
41 // CHECK-NEXT: | `-ConstantExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:22> 'int'
42 // CHECK-NEXT: | |-value: Int 1
43 // CHECK-NEXT: | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}} <col:22> 'int' 1
44 // CHECK-NEXT: `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, int, 1>' sugar
45 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, int, 1>' sugar alias
46 // CHECK-NEXT: |-name: '__make_integer_seq' qualified
47 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
48 // CHECK-NEXT: |-TemplateArgument template 'A'
49 // CHECK-NEXT: | `-ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:1, col:41> col:38 A
50 // CHECK-NEXT: |-TemplateArgument type 'int'
51 // CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
52 // CHECK-NEXT: |-TemplateArgument expr '1'
53 // CHECK-NEXT: | `-ConstantExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:64> 'int'
54 // CHECK-NEXT: | |-value: Int 1
55 // CHECK-NEXT: | `-SubstNonTypeTemplateParmExpr 0x{{[0-9A-Fa-f]+}} <col:64> 'int'
56 // CHECK-NEXT: | |-NonTypeTemplateParmDecl 0x{{[0-9A-Fa-f]+}} <col:21, col:24> col:24 referenced 'B1' depth 0 index 1 B2
57 // CHECK-NEXT: | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}} <col:64> 'int' 1
58 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} 'A<int, 0>' sugar
59 // CHECK-NEXT: |-name: 'A' qualified
60 // CHECK-NEXT: | `-ClassTemplateDecl {{.+}} A
61 // CHECK-NEXT: |-TemplateArgument type 'int'
62 // CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
63 // CHECK-NEXT: |-TemplateArgument expr '0'
64 // CHECK-NEXT: | `-ConstantExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:64> 'int'
65 // CHECK-NEXT: | |-value: Int 0
66 // CHECK-NEXT: | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}} <col:64> 'int' 0
67 // CHECK-NEXT: `-RecordType 0x{{[0-9A-Fa-f]+}} 'A<int, 0>'
68 // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{[0-9A-Fa-f]+}} 'A'
70 template <template <class T, T...> class S, class T, int N> struct C {
71 using test3 = __make_integer_seq<S, T, N>;
72 // CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:3, col:43> col:9 test3 '__make_integer_seq<S, T, N>':'__make_integer_seq<template-parameter-0-0, type-parameter-0-1, N>'
73 // CHECK-NEXT: `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<S, T, N>' sugar dependent
74 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<S, T, N>' sugar dependent alias
75 // CHECK-NEXT: |-name: '__make_integer_seq' qualified
76 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
77 // CHECK-NEXT: |-TemplateArgument template 'S'
78 // CHECK-NEXT: | | `-TemplateTemplateParmDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:11, col:42> col:42 depth 0 index 0 S
79 // CHECK-NEXT: |-TemplateArgument type 'T'
80 // CHECK-NEXT: | `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'T' dependent depth 0 index 1
81 // CHECK-NEXT: | `-TemplateTypeParm 0x{{[0-9A-Fa-f]+}} 'T'
82 // CHECK-NEXT: |-TemplateArgument expr 'N'
83 // CHECK-NEXT: | `-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:42> 'T' <Dependent>
84 // CHECK-NEXT: | `-DeclRefExpr 0x{{[0-9A-Fa-f]+}} <col:42> 'int' NonTypeTemplateParm 0x{{[0-9A-Fa-f]+}} 'N' 'int'
85 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<template-parameter-0-0, type-parameter-0-1, N>' dependent
86 // CHECK-NEXT: |-name: '__make_integer_seq'
87 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
88 // CHECK-NEXT: |-TemplateArgument template 'template-parameter-0-0'
89 // CHECK-NEXT: | `-TemplateTemplateParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> depth 0 index 0
90 // CHECK-NEXT: |-TemplateArgument type 'type-parameter-0-1'
91 // CHECK-NEXT: | `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1' dependent depth 0 index 1
92 // CHECK-NEXT: `-TemplateArgument expr 'N'
93 // CHECK-NEXT: `-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <col:42> 'T' <Dependent>
94 // CHECK-NEXT: `-DeclRefExpr 0x{{[0-9A-Fa-f]+}} <col:42> 'int' NonTypeTemplateParm 0x{{[0-9A-Fa-f]+}} 'N' 'int'
96 using test4 = __make_integer_seq<A, T, 1>;
97 // CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:3, col:43> col:9 test4 '__make_integer_seq<A, T, 1>':'__make_integer_seq<A, type-parameter-0-1, 1>'
98 // CHECK-NEXT: `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, T, 1>' sugar dependent
99 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, T, 1>' sugar dependent alias
100 // CHECK-NEXT: |-name: '__make_integer_seq' qualified
101 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
102 // CHECK-NEXT: |-TemplateArgument template 'A'
103 // CHECK-NEXT: | `-ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:1, col:41> col:38 A
104 // CHECK-NEXT: |-TemplateArgument type 'T'
105 // CHECK-NEXT: | `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'T' dependent depth 0 index 1
106 // CHECK-NEXT: | `-TemplateTypeParm 0x{{[0-9A-Fa-f]+}} 'T'
107 // CHECK-NEXT: |-TemplateArgument expr '1'
108 // CHECK-NEXT: | `-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:42> 'T' <Dependent>
109 // CHECK-NEXT: | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}} <col:42> 'int' 1
110 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, type-parameter-0-1, 1>' dependent
111 // CHECK-NEXT: |-name: '__make_integer_seq'
112 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
113 // CHECK-NEXT: |-TemplateArgument template 'A'
114 // CHECK-NEXT: | `-ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:1, col:41> col:38 A
115 // CHECK-NEXT: |-TemplateArgument type 'type-parameter-0-1'
116 // CHECK-NEXT: | `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1' dependent depth 0 index 1
117 // CHECK-NEXT: `-TemplateArgument expr '1'
118 // CHECK-NEXT: `-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:42> 'T' <Dependent>
119 // CHECK-NEXT: `-IntegerLiteral 0x{{[0-9A-Fa-f]+}} <col:42> 'int' 1
121 using test5 = __make_integer_seq<A, int, N>;
122 // CHECK: `-TypeAliasDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:3, col:45> col:9 test5 '__make_integer_seq<A, int, N>'
123 // CHECK-NEXT: `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, int, N>' sugar dependent
124 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, int, N>' sugar dependent alias
125 // CHECK-NEXT: |-name: '__make_integer_seq' qualified
126 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
127 // CHECK-NEXT: |-TemplateArgument template 'A'
128 // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} <line:{{.+}}:1, col:41> col:38 A
129 // CHECK-NEXT: |-TemplateArgument type 'int'
130 // CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
131 // CHECK-NEXT: |-TemplateArgument expr 'N'
132 // CHECK-NEXT: | `-DeclRefExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:44> 'int' NonTypeTemplateParm 0x{{[0-9A-Fa-f]+}} 'N' 'int'
133 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__make_integer_seq<A, int, N>' dependent
134 // CHECK-NEXT: |-name: '__make_integer_seq'
135 // CHECK-NEXT: | `-BuiltinTemplateDecl {{.+}} __make_integer_seq
136 // CHECK-NEXT: |-TemplateArgument template 'A'
137 // CHECK-NEXT: | `-ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:1, col:41> col:38 A
138 // CHECK-NEXT: |-TemplateArgument type 'int'
139 // CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
140 // CHECK-NEXT: `-TemplateArgument expr 'N'
141 // CHECK-NEXT: `-DeclRefExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:44> 'int' NonTypeTemplateParm 0x{{[0-9A-Fa-f]+}} 'N' 'int'
144 // expected-no-diagnostics
146 template <class T, class S> struct D;
147 template <class T> struct D<T, __make_integer_seq<A, int, sizeof(T)>> {};
148 template struct D<char, A<int, 0>>;
150 template <class T, class S> struct E;
151 template <class T> struct E<T, __make_integer_seq<A, T, 2>> {};
152 template struct E<short, A<short, 0, 1>>;
154 template <template <class A1, A1... A2> class T, class S> struct F;
155 template <template <class A1, A1... A2> class T> struct F<T, __make_integer_seq<T, long, 3>> {};
156 template struct F<A, A<long, 0, 1, 2>>;
158 template <class T> struct G;
159 template <class T> struct G<__make_integer_seq<A, T, 1>> {};
160 template <class T> struct G<__make_integer_seq<A, T, 1U>> {};
162 template <int S, class = __make_integer_seq<A, int, S>> struct H;
163 template <int S, int... Is> struct H<S, A<int, Is...>> { };
165 template <int S> void h(H<S>);
166 void test_h() { h(H<5>{}); }