C++ interpreter: Cast the pointer, not the reference

May result in warnings otherwise

```
slint_interpreter.h:426:79: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  426 |                 &inner, &reinterpret_cast<slint::SharedVector<ValueOpaque> &>(array))) {
      |                                                                               ^~~~~
```
This commit is contained in:
Olivier Goffart 2022-03-09 13:09:22 +01:00
parent 4d31ec5874
commit 15781411de

View file

@ -416,14 +416,14 @@ private:
inline Value::Value(const slint::SharedVector<Value> &array)
{
cbindgen_private::slint_interpreter_value_new_array_model(
&reinterpret_cast<const slint::SharedVector<ValueOpaque> &>(array), &inner);
reinterpret_cast<const slint::SharedVector<ValueOpaque> *>(&array), &inner);
}
inline std::optional<slint::SharedVector<Value>> Value::to_array() const
{
slint::SharedVector<Value> array;
if (cbindgen_private::slint_interpreter_value_to_array(
&inner, &reinterpret_cast<slint::SharedVector<ValueOpaque> &>(array))) {
&inner, reinterpret_cast<slint::SharedVector<ValueOpaque> *>(&array))) {
return array;
} else {
return {};