[clazy] [Bug 480325] New: Detaching of QList::last and QList::first

bugzilla_noreply at kde.org bugzilla_noreply at kde.org
Thu Jan 25 15:40:22 GMT 2024


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

            Bug ID: 480325
           Summary: Detaching of QList::last and QList::first
    Classification: Developer tools
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: aklitzing at gmail.com
                CC: smartins at kde.org
  Target Milestone: ---

It seems QList::last and QList::first on Qt6 is a false-positive for
Wclazy-detaching-member.

We get for this a warning.

QStringList list;
list << "dummy";
list.last().append("hello");

But it won't call any detaching.

    inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); }
    inline const T &first() const noexcept { Q_ASSERT(!isEmpty()); return
*begin(); }

    inline T& last() { Q_ASSERT(!isEmpty()); return *(end()-1); }
    inline const T &last() const noexcept { Q_ASSERT(!isEmpty()); return
*(end()-1); }

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


More information about the Unassigned-bugs mailing list