BitFields icon indicating copy to clipboard operation
BitFields copied to clipboard

Possible to create BitX with invalid value (out of range)

Open fanoI opened this issue 8 years ago • 1 comments

This works correctly:

Bit3 b3 = 99;

I got the expected error: "Constant value '99' cannot be converted to a 'Bit3'"

but this passes:

Bit3 b3 = 98 + 1;

Admittedly is strange to use the '+' on a Bit... I don't if is possible to catch this error too or not...

fanoI avatar Apr 30 '17 14:04 fanoI

It's on todo list.

https://github.com/ufcpp/BitFields/blob/master/src/BitFieldsAnalyzer/BitFieldsAnalyzer/BitNAnalyzer.cs#L52

I think it's necessary but a bit hard task.

ufcpp avatar May 02 '17 01:05 ufcpp