diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-01-24 16:47:18 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-26 20:45:52 +0000 |
commit | 8134b35f2f199b0d704f84b76ad910e1425997c7 (patch) | |
tree | ce8ac673d445538d466430c73c5e5d2938669e60 /examples/designer/worldtimeclockplugin | |
parent | eae03b13ea5463906d88dea6f3ebf2c7f1747ce4 (diff) |
HelpEngineWrapper: fix API susceptible to GCC 13 -Wdangling-reference
GCC 13 currently assumes that the temporary argument (the default
value) ends up embedded in the result, and warns:
helpviewer.cpp:393:34: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
393 | const HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
| ^~~~~~~~~~
helpviewer.cpp:393:74: note: the temporary was destroyed at the end of the full expression ‘Qt6::HelpEngineWrapper::instance(Qt6::QString())’
393 | const HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
An attempt to fix the issue by passing the QString by value made it
worse, as all calls threw the warning then, including those that pass
a QString instead of relying on the defaulted argument.
So, heed QTBUG-98117 and overload instead of using default
arguments. Having the nullary overload in the same TU as the unary one
seems to make GCC shut up about the False Positive dangling.
Task-number: QTBUG-98117
Change-Id: I69da70dfbf996ab923078631031f6f3c7a5cfcbe
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 14fe0bbea5b04dff01495e815b33a0a1dd2e191a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/designer/worldtimeclockplugin')
0 files changed, 0 insertions, 0 deletions