There are a few different bugs here, but they're all to do with the const detection. The following all erroneously produce a "Exceptional return value must be a constant" error when passed to exceptional return:
Negative int literals. These should just work.
Simple enums values. These should also just work.
An enhanced enum. This should produce a type mismatch error, but is reported as the same constness error, so the user didn't know that they were supposed to pass dc_status_t.DC_STATUS_TIMEOUT.value.
The enhanced enum's .value field doesn't work anyway.
Summary:Pointer.fromFunction incorrectly flags negative integers, enums, and enhanced enum values as non-constant when used with exceptional return parameters. Const detection needs improvement.
A user reported some bugs with
Pointer.fromFunction
's exceptional return param: https://github.com/dart-lang/native/issues/1724There are a few different bugs here, but they're all to do with the const detection. The following all erroneously produce a "Exceptional return value must be a constant" error when passed to exceptional return:
dc_status_t.DC_STATUS_TIMEOUT.value
..value
field doesn't work anyway.