Bug 451686

Summary: false positive: Wclazy-use-static-qregularexpression on dynamic QString
Product: [Developer tools] clazy Reporter: tsteven4
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: REPORTED ---    
Severity: normal CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: modified clazy/tests/use-static-qregularexpression/main.cpp

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.