Bug 439338

Summary: clazy-qt6-deprecated-api-fixes creates invalid code for QDate::startOfDay
Product: [Developer tools] clazy Reporter: Nicolas Fella <nicolas.fella>
Component: generalAssignee: Jörg Bornemann <joerg.bornemann>
Status: REPORTED ---    
Severity: normal CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicolas Fella 2021-06-30 15:15:00 UTC
Consider the following code

#include <QDateTime>

struct Foo {

    QDate someDate() {
        return {};
    }
};

int main(int argc, char *argv[])
{
    Foo *foo = new Foo;
    QDateTime{foo->someDate()};
}


clazy warns that the QDateTime ctor is deprecated and suggests to use QDate::startOfDay()

The fixit generates:

foo->startOfDay();

while it should be

foo->someDate().startOfDay();