| Summary: | Detaching of QList::last and QList::first | ||
|---|---|---|---|
| Product: | [Developer tools] clazy | Reporter: | aklitzing |
| Component: | general | Assignee: | Unassigned bugs <unassigned-bugs-null> |
| Status: | RESOLVED NOT A BUG | ||
| Severity: | normal | CC: | smartins |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
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); }