File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1223,19 +1223,21 @@ $(H4 $(LNAME2 cast_integers, Integers))
1223
1223
---
1224
1224
)
1225
1225
1226
- $(P Casting between signed and unsigned types will reinterpret the
1226
+ $(P Converting between signed and unsigned types will reinterpret the
1227
1227
value if the destination type cannot represent the source
1228
1228
value.)
1229
1229
1230
1230
$(SPEC_RUNNABLE_EXAMPLE_RUN
1231
1231
---
1232
1232
short c = -1;
1233
- auto d = cast(ushort) c;
1233
+ ushort d = c;
1234
1234
assert(d == ushort.max);
1235
+ assert(uint(c) == uint.max);
1235
1236
1236
1237
ubyte e = 255;
1237
- auto f = cast(byte) e;
1238
- assert(f == -1);
1238
+ byte f = e;
1239
+ assert(f == -1); // reinterpreted
1240
+ assert(short(e) == 255); // no change
1239
1241
---
1240
1242
)
1241
1243
You can’t perform that action at this time.
0 commit comments