[clazy] [Bug 358732] New: qstring-uneeded-heap-allocations: fixit changes QString to QLatin1String even if a QString function (sprintf, arg...) on that object

NooN via KDE Bugzilla bugzilla_noreply at kde.org
Fri Jan 29 13:00:10 GMT 2016


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

            Bug ID: 358732
           Summary: qstring-uneeded-heap-allocations: fixit changes
                    QString to QLatin1String even if a QString function
                    (sprintf, arg...) on that object
           Product: clazy
           Version: unspecified
          Platform: Debian testing
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: oo.o+kde at windbuechse.samba-tng.org
                CC: smartins at kde.org

Created attachment 96901
  --> https://bugs.kde.org/attachment.cgi?id=96901&action=edit
testcase for QString with sprintf

If a QString is created and a function of that object get's called ist must not
be converted to a QLatin1String.
That class has only a minimal set of functions and for example arg or sprintf
is not supported.

testcase_qstring.cpp:21:5: warning: QString(const char*) being called
[-Wclazy-qstring-uneeded-heap-allocations]
    QString("").sprintf("0x%02X", 0x1E);

If the (automatic) fixit get applied there is than a no member error.

testcase_with_fixit.cpp:21:23: error: no member named 'sprintf' in
'QLatin1String'
    QLatin1String("").sprintf("0x%02X", 0x1E);

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



More information about the Unassigned-bugs mailing list