test "widening" {
const a: u16 = 1024;
const b: u16 = 512;
const c: u32 = a * b;
try std.testing.expect(c == 1024 * 512);
}
Yields:
error: overflow of integer type 'u16' with value '524288'
const c: u32 = a * b;
~~^~~
To get it to work I need to do something like:
const aa: u32 = a;
const bb: u32 = b;
const c: u32 = a * b;
Which seems overly verbose. Is this a bug or intended behavior?