mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
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:
parent
4d31ec5874
commit
15781411de
1 changed files with 2 additions and 2 deletions
|
@ -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 {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue