Debian Codegraph @

gcc/testsuite/gdc.test/compilable/casttuple.d

raw
1 alias tuple(T...) = T;
2
3 void exactMatch()
4 {
5 tuple!int tup_1;
6
7 auto i = cast() tup_1;
8 static assert(is(typeof(i) == int));
9 const i_const = cast(const) tup_1;
10 static assert(is(typeof(i_const) == const int));
11
12 auto totup_1 = cast(tuple!int) tup_1;
13 static assert(is(typeof(totup_1) == tuple!int));
14
15 tuple!(int, int) tup_2;
16 auto totup_2 = cast(tuple!(int, int)) tup_2;
17 static assert(is(typeof(totup_2) == tuple!(int, int)));
18 }
19
20 void implicitConv()
21 {
22 tuple!short tup_1;
23 auto totup_1 = cast(tuple!int) tup_1;
24 static assert(is(typeof(tup_1) == tuple!short));
25 static assert(is(typeof(totup_1) == tuple!int));
26
27 tuple!(short, short) tup_2;
28 auto totup_2 = cast(tuple!(int, int)) tup_2;
29 static assert(is(typeof(tup_2) == tuple!(short, short)));
30 static assert(is(typeof(totup_2) == tuple!(int, int)));
31 }