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

            Bug ID: 497866
           Summary: Add a detach warning when a Qt container is converted
                    to a QSpan / std::span
    Classification: Developer tools
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-b...@kde.org
          Reporter: dange...@gmail.com
                CC: smart...@kde.org
  Target Milestone: ---

The ranged constructors for QSpan and std::span will call .data() on the input.
Even if the element type of the span is const, this will result in a detach if
a Qt container is passed, e.g.

```
void f(std::span<const int> s); // will only read, never mutate

QList<int> list = ~~~;
f(list); // unnecessary detach here
```

Clazy should extend its "detach" family of warnings to cover this case, since
span is vocabulary types, making the above error-prone.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to