| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/b12504.d(26): Error: cannot implicitly convert expression `257$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ubyte` |
| 5 |
fail_compilation/b12504.d(27): Error: index type `ubyte` cannot cover index range 0..257 |
| 6 |
fail_compilation/b12504.d(31): Error: cannot implicitly convert expression `129$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `byte` |
| 7 |
fail_compilation/b12504.d(32): Error: index type `byte` cannot cover index range 0..129 |
| 8 |
fail_compilation/b12504.d(36): Error: cannot implicitly convert expression `65537$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ushort` |
| 9 |
fail_compilation/b12504.d(37): Error: index type `ushort` cannot cover index range 0..65537 |
| 10 |
fail_compilation/b12504.d(41): Error: cannot implicitly convert expression `32769$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `short` |
| 11 |
fail_compilation/b12504.d(42): Error: index type `short` cannot cover index range 0..32769 |
| 12 |
fail_compilation/b12504.d(46): Error: cannot implicitly convert expression `257$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ubyte` |
| 13 |
fail_compilation/b12504.d(47): Error: index type `ubyte` cannot cover index range 0..257 |
| 14 |
fail_compilation/b12504.d(51): Error: cannot implicitly convert expression `129$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `byte` |
| 15 |
fail_compilation/b12504.d(52): Error: index type `byte` cannot cover index range 0..129 |
| 16 |
fail_compilation/b12504.d(56): Error: cannot implicitly convert expression `65537$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `ushort` |
| 17 |
fail_compilation/b12504.d(57): Error: index type `ushort` cannot cover index range 0..65537 |
| 18 |
fail_compilation/b12504.d(61): Error: cannot implicitly convert expression `32769$?:32=u|64=LU$` of type `$?:32=uint|64=ulong$` to `short` |
| 19 |
fail_compilation/b12504.d(62): Error: index type `short` cannot cover index range 0..32769 |
| 20 |
--- |
| 21 |
*/ |
| 22 |
void main() |
| 23 |
{ |
| 24 |
{ |
| 25 |
int[0xFF + 2] sta; |
| 26 |
foreach (ubyte i; 0 .. sta.length) {} |
| 27 |
foreach (ubyte i, x; sta) {} |
| 28 |
} |
| 29 |
{ |
| 30 |
int[0x7F + 2] sta; |
| 31 |
foreach (byte i; 0 .. sta.length) {} |
| 32 |
foreach (byte i, x; sta) {} |
| 33 |
} |
| 34 |
{ |
| 35 |
int[0xFFFF + 2] sta; |
| 36 |
foreach (ushort i; 0 .. sta.length) {} |
| 37 |
foreach (ushort i, x; sta) {} |
| 38 |
} |
| 39 |
{ |
| 40 |
int[0x7FFF + 2] sta; |
| 41 |
foreach (short i; 0 .. sta.length) {} |
| 42 |
foreach (short i, x; sta) {} |
| 43 |
} |
| 44 |
{ |
| 45 |
immutable int[0xFF + 2] sta; |
| 46 |
static foreach (ubyte i; 0 .. sta.length) {} |
| 47 |
static foreach (ubyte i, x; sta) {} |
| 48 |
} |
| 49 |
{ |
| 50 |
immutable int[0x7F + 2] sta; |
| 51 |
static foreach (byte i; 0 .. sta.length) {} |
| 52 |
static foreach (byte i, x; sta) {} |
| 53 |
} |
| 54 |
{ |
| 55 |
immutable int[0xFFFF + 2] sta; |
| 56 |
static foreach (ushort i; 0 .. sta.length) {} |
| 57 |
static foreach (ushort i, x; sta) {} |
| 58 |
} |
| 59 |
{ |
| 60 |
immutable int[0x7FFF + 2] sta; |
| 61 |
static foreach (short i; 0 .. sta.length) {} |
| 62 |
static foreach (short i, x; sta) {} |
| 63 |
} |
| 64 |
} |