node-addon-api
node-addon-api copied to clipboard
src: fix -Wconversion msg/C++17 UB from unknown_array_type
Opening gambit to fix #1066. Only lightly tested (I'll fix the errors, no need to comment on those). Seeking feedback on the approach before adding tests.
Breaking change: this makes code like TypedArrayOf<bool>::New() fail at compile-time instead of run-time. The other changes I think are non-breaking.
Breaking change: this makes code like TypedArrayOf
::New() fail at compile-time instead of run-time
I'm not sure we want a breaking change if your earlier comment:
I don't think this is really an issue, but it would be nice to get rid of the warning.
is correct. Is there no way to fix the warning without breaking existing code?
We looked at this in detail today. The thought was that the right approach might be to remove the concept of an unknown type completely.
In the contructor with no options, then just use a default type (maybe int8)
In the contructor that passes in an napi_value then do the lookup immediately versus defering.
We can't think of any way this should affect working existing code.
@KevinEady is going to take a look at implementing the suggestion to remove concept of an unknown type completely.
Closing as this will be fixed by https://github.com/nodejs/node-addon-api/pull/1209 instead.