Mercurial > projects > dstress
comparison compile/t/tuple_27_A.d @ 1622:d402aa53926c
Add test for bug 3092 written by Manuel K?nig
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Tue, 19 Oct 2010 19:18:23 -0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1621:8f6d65d2b129 | 1622:d402aa53926c |
---|---|
1 // $HeadURL$ | |
2 // $Date$ | |
3 // $Author$ | |
4 | |
5 // @author@ Manuel König <manuelk89@gmx.net> | |
6 // @date@ 2010-10-11 | |
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=3092 | |
8 // @desc@ [Issue 3092] Indexing a tuple produces a tuple containing the indexed element (only happens when indexing type items in a non-type-tuple) | |
9 | |
10 module dstress.compile.t.tuple_27_A; | |
11 | |
12 template TupleBug(values...) | |
13 { | |
14 alias values[0] v0; | |
15 alias values[0][0][0][0][0] chain; | |
16 | |
17 /* for debugging this test case | |
18 pragma(msg, "values: ", values); | |
19 pragma(msg, "v0: ", v0); | |
20 pragma(msg, "values[0]: ", values[0]); | |
21 pragma(msg, "chain: ", chain); | |
22 | |
23 eg. for TupleBug!(int, 1, char) this should print | |
24 | |
25 values: tuple(int, 1, char) | |
26 v0: int | |
27 values[0]: int | |
28 chain: int[0][0][0][0] | |
29 | |
30 When v0, values[0 and chain are printed correct, but values | |
31 looks like | |
32 | |
33 values: tuple((int), 1, (char)) | |
34 | |
35 this is most likely only a formatting bug in expToCBuffer in expression.c. | |
36 */ | |
37 | |
38 static assert(is(v0 == int)); | |
39 static assert(is(chain == int[0][0][0][0])); | |
40 | |
41 v0 i; | |
42 chain c; | |
43 | |
44 static assert(is(typeof(i) == int)); | |
45 static assert(is(typeof(c) == int[0][0][0][0])); | |
46 } | |
47 | |
48 alias TupleBug!(int) _0; | |
49 alias TupleBug!(int, "foo") _1; | |
50 alias TupleBug!(int, 1, char) _2; | |
51 alias TupleBug!(int, ulong, char[], void*) _3; | |
52 |