mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Move dmd files into compiler/
This commit is contained in:
parent
20bd0cacbd
commit
6374bb87b7
4579 changed files with 4 additions and 4 deletions
40
compiler/test/compilable/aliasassign.d
Normal file
40
compiler/test/compilable/aliasassign.d
Normal file
|
@ -0,0 +1,40 @@
|
|||
template AliasSeq(T...) { alias AliasSeq = T; }
|
||||
|
||||
template Unqual(T)
|
||||
{
|
||||
static if (is(T U == const U))
|
||||
alias Unqual = U;
|
||||
else static if (is(T U == immutable U))
|
||||
alias Unqual = U;
|
||||
else
|
||||
alias Unqual = T;
|
||||
}
|
||||
|
||||
template staticMap(alias F, T...)
|
||||
{
|
||||
alias A = AliasSeq!();
|
||||
static foreach (t; T)
|
||||
A = AliasSeq!(A, F!t); // what's tested
|
||||
alias staticMap = A;
|
||||
}
|
||||
|
||||
alias TK = staticMap!(Unqual, int, const uint);
|
||||
//pragma(msg, TK);
|
||||
static assert(is(TK == AliasSeq!(int, uint)));
|
||||
|
||||
/**************************************************/
|
||||
|
||||
template reverse(T...)
|
||||
{
|
||||
alias A = AliasSeq!();
|
||||
static foreach (t; T)
|
||||
A = AliasSeq!(t, A); // what's tested
|
||||
alias reverse = A;
|
||||
}
|
||||
|
||||
enum X2 = 3;
|
||||
alias TK2 = reverse!(int, const uint, X2);
|
||||
//pragma(msg, TK2);
|
||||
static assert(TK2[0] == 3);
|
||||
static assert(is(TK2[1] == const(uint)));
|
||||
static assert(is(TK2[2] == int));
|
Loading…
Add table
Add a link
Reference in a new issue