[clazy] [Bug 443342] New: lambda-in-connect false positive, when a lambda is nested in another lambda

bugzilla_noreply at kde.org bugzilla_noreply at kde.org
Tue Oct 5 09:38:36 BST 2021


https://bugs.kde.org/show_bug.cgi?id=443342

            Bug ID: 443342
           Summary: lambda-in-connect false positive, when a lambda is
                    nested in another lambda
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Microsoft Windows
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: julien.cugniere at gmail.com
                CC: smartins at kde.org
  Target Milestone: ---

Created attachment 142163
  --> https://bugs.kde.org/attachment.cgi?id=142163&action=edit
lambda-in-connect-false-positive.cpp

SUMMARY

lambda-in-connect false positive when a capturing lambda is nested inside the
connected lambda.

STEPS TO REPRODUCE

1. Run clazy on attached file lambda-in-connect-false-positive.cpp

OBSERVED RESULT

lambda-in-connect-false-positive.cpp(8,4): warning: captured local variable by
reference might go out of scope before lambda is called
[-Wclazy-lambda-in-connect]
                        foo++;

EXPECTED RESULT

No warning. The connected lambda is not capturing foo (only the nested lambda
is), so there's no risk.

SOFTWARE/OS VERSIONS

Windows: 21H1
Qt Version: Qt 5.15.2
clazy_v1.8-msvc2019.zip as build by KDAB (File lambda-in-connect.cpp has no
commits between 1.8 and master).

ADDITIONAL INFORMATION

If the connected lambda is capturing by reference something other than foo, the
warning should still not appear.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list