1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
// PERMUTE_ARGS:
// REQUIRED_ARGS: -o-
struct A(Args...)
{
enum i = 1;
// base use case.
Args[0].T mBase;
static assert(is(typeof(mBase) == B.T));
// chained types
Args[0].T.TT mChain;
static assert(is(typeof(mChain) == B.T.TT));
// chained packs
Args[1+1].FArgs[0] mChainPack;
static assert(is(typeof(mChainPack) == B));
// expr
enum mExpr = Args[1].i;
static assert(mExpr == B.i);
// Nested + index eval
Args[Args[0].i2].T mNested;
static assert(is(typeof(mNested) == B.T));
// index with constexpr
Args[i].T mCEIndex;
static assert(is(typeof(mCEIndex) == B.T));
// Nested + index with constexpr
Args[Args[i].i2].T mNestedCE;
static assert(is(typeof(mNestedCE) == B.T));
// alias, base use case
alias UBase = Args[0].T;
static assert(is(UBase == B.T));
// alias, chained types
alias UChain = Args[0].T.TT;
static assert(is(UChain == B.T.TT));
// alias, chained packs
alias UChainPack = Args[1+1].FArgs[0];
static assert(is(UChainPack == B));
// alias, expr
alias uExpr = Args[1].i;
static assert(uExpr == B.i);
// alias, Nested + index eval
alias UNested = Args[Args[0].i2].T;
static assert(is(UNested == B.T));
// alias, index with constexpr
alias UCEIndex = Args[i].T;
static assert(is(UCEIndex == B.T));
// alias, Nested + index with constexpr
alias UNextedCE = Args[Args[i].i2].T;
static assert(is(UNextedCE == B.T));
}
struct B
{
struct T
{
struct TT
{
}
}
enum i = 6;
enum i2 = 0;
}
struct C(Args...)
{
alias FArgs = Args;
}
alias Z = A!(B,B,C!(B,B));
/***************************************************/
// 14889
struct A14889(alias Exc)
{
alias ExceptionType = Exc;
}
alias TT14889(Args...) = Args;
alias X14889a = TT14889!(A14889!Throwable());
alias Y14889a = X14889a[0].ExceptionType;
alias X14889b = TT14889!(A14889!Throwable);
alias Y14889b = X14889b[0].ExceptionType;
/***************************************************/
// 14889
alias TypeTuple14900(T...) = T;
struct S14900
{
alias T = int;
alias U = TypeTuple14900!(long,string);
}
alias Types14900 = TypeTuple14900!(S14900, S14900);
Types14900[0].T a14900; // Types[0] == S, then typeof(a) == S.T == int
Types14900[0].U[1] b14900; // Types[0].U == S.U, then typeof(b) == S.U[1] == string
void test14900()
{
Types14900[0].T a; // Types[0] == S, then typeof(a) == S.T == int
Types14900[0].U[1] b; // Types[0].U == S.U, then typeof(b) == S.U[1] == string
}
/***************************************************/
// 14911
void test14911()
{
struct S {}
int* buf1 = new int[2].ptr; // OK
S* buf2 = (new S[2]).ptr; // OK
S* buf3 = new S[2].ptr; // OK <- broken
}
/***************************************************/
// 14986
alias Id14986(alias a) = a;
struct Foo14986
{
int tsize;
}
struct Bar14986
{
enum Foo14986[] arr = [Foo14986()];
}
Bar14986 test14986()
{
Foo14986[] types;
auto a1 = new void[types[0].tsize]; // TypeIdentifier::toExpression
auto a2 = new void[Id14986!types[0].tsize]; // TypeInstance::toExpression
Bar14986 bar;
auto a3 = Id14986!(typeof(bar).arr[0].tsize); // TypeTypeof::resolve
auto a4 = Id14986!(typeof(return).arr[0].tsize); // TypeReturn::resolve
return Bar14986();
}
|