aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-11-09 08:44:01 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-09 14:00:34 +0000
commit43b248cb4bb15bf398ed602cc40a8ae0e1da44f7 (patch)
treec4c1a6191977e32402dadfb5ac618639a17e80ec
parentab5511ca335fe3c4ffeb5d4c222a60c2d02a40b3 (diff)
QML DOM: Avoid warning on integrity and make check compile time
Given that we use if constexpr, we should detect the error condition already at compile time. Also, add an return statement to the branch so that the Integrity compiler will not complain about it, even if it is never executed. Fixes: QTBUG-98109 Change-Id: I86b5ecffcdaf794a0afab29496daf82f9b2ddf56 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit eb415d93b9f8e71dc1726fa03458fdaa30b67ada) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qmldom/qqmldomitem_p.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qmldom/qqmldomitem_p.h b/src/qmldom/qqmldomitem_p.h
index c3720d74ea..9388309bf7 100644
--- a/src/qmldom/qqmldomitem_p.h
+++ b/src/qmldom/qqmldomitem_p.h
@@ -588,7 +588,9 @@ public:
} else if constexpr (domTypeIsObjWrap(T::kindValue)) {
return m_value.value<T *>();
} else {
- Q_ASSERT_X(false, "SimpleObjectWrapT", "wrapping of unexpected type");
+ // need dependent static assert to not unconditially trigger
+ static_assert(!std::is_same_v<T, T>, "wrapping of unexpected type");
+ return nullptr; // necessary to avoid warnings on INTEGRITY
}
}