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: RESOLVED UNMAINTAINED    
Severity: normal CC: alexander.lohnau, smartins
Priority: NOR    
Version First Reported In: 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();
Comment 1 Alexander Lohnau 2025-09-04 17:13:40 UTC
The Qt6 porting checks are deprecated with clazy 1.16