Bug 451686 - false positive: Wclazy-use-static-qregularexpression on dynamic QString
Summary: false positive: Wclazy-use-static-qregularexpression on dynamic QString
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Other
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-19 15:23 UTC by tsteven4
Modified: 2022-03-19 15:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
modified clazy/tests/use-static-qregularexpression/main.cpp (2.99 KB, text/plain)
2022-03-19 15:23 UTC, tsteven4
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tsteven4 2022-03-19 15:23:44 UTC
Created attachment 147598 [details]
modified  clazy/tests/use-static-qregularexpression/main.cpp

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. export CLAZY_CHECKS=level0,level1

2. qmake -spec linux-clang "CONFIG+=debug" "QMAKE_CXX=clazy" atest.pro

3. make atest.o

OBSERVED RESULT
atest.cpp:121:5: warning: Don't create temporary QRegularExpression objects. Use a static QRegularExpression object instead [-Wclazy-use-static-qregularexpression]
    re3.match(text);


EXPECTED RESULT
no warning on this line


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Ubuntu jammy
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 6.2.2

ADDITIONAL INFORMATION
clazy version 1.11

atest.pro:
CONFIG += c++17
SOURCES+=atest.cpp

atest.cpp, attached, is a modification of clazy/tests/use-static-qregularexpression/main.cpp.