[Development] MSVC not inlining QRect inline functions (anymore?)

Mårten Nordheim marten.nordheim at qt.io
Mon Jun 8 17:40:57 CEST 2026


>From my testing it was not working with QRectF. But maybe I was not using a high enough optimization level...
The functions all reported not being inlined due to 'dllimport check failed'.

Testing with this, and a small class that uses various QRect(F) members:

cl.exe /nologo /O2 /Ob2 /std:c++20 /Zc:__cplusplus /EHsc /MD
    /I "C:\projects\qt\dev\build-release\qtbase\include"
    /I "C:\projects\qt\dev\build-release\qtbase\include\QtCore"
    /D QT_CORE_LIB /D UNICODE /D _UNICODE
    /d2inlinestats /d2cgsummary
    /FAcs /Fa"C:\temp\qrectf_test.asm"
    /c "C:\temp\qrectf_test.cpp"
    /Fo"C:\temp\qrectf_test.obj"

The /d2inlinestats /d2cgsummary are the ones that output details on the inlining.

________________________________________
From: Development <development-bounces at qt-project.org> on behalf of Christian Ehrlicher via Development <development at qt-project.org>
Sent: Monday, June 8, 2026 17:35
To: development at qt-project.org
Subject: Re: [Development] MSVC not inlining QRect inline functions (anymore?)

That's strange - why does it work with QRectF then?

Christian

Am 08.06.2026 um 17:28 schrieb Mårten Nordheim via Development:
> Testing this with the inline debugging things from MSVC it is simply listing the reason for not inlining as 'dllimport check failed'.
> So it seems to not inline solely based on it being marked dllimport.
>
> Could we perhaps make some of these functions export-only? Just remove the dllimport side of things, only export the symbol.
>
> Mårten
>
> ________________________________________
> From: Development <development-bounces at qt-project.org> on behalf of Philippe <philwave at gmail.com>
> Sent: Monday, June 8, 2026 16:05
> To: development at qt-project.org
> Subject: Re: [Development] MSVC not inlining QRect inline functions (anymore?)
>
> I have just verified that not only QRect, but QPoint, QSize and QMargins are
> also affected :(
>
> QCheckedInt overflow checks only manifest as assertions in debug builds.
> Yet, this debug-only feature has a negative impact on the MSVC release
> version :(
> Not exactly, "Pay Only For What You Use"...
>
> Philippe
>
> On Sun, 7 Jun 2026 17:48:33 +0200
> Christian Ehrlicher via Development <development at qt-project.org> wrote:
>
>> Hi,
>>
>> I recently found out that none of the QRect inline functions are inlined by msvc no matter what compiler options I pass. Tested with recent cl (19.51.36244) but also saw this with older msvc2022 compilers.
>> Is this known and should/can we do something against this?
>>
>>
>> Christian
>> -- Development mailing list
>> Development at qt-project.org
>> https://lists.qt-project.org/listinfo/development
>
> --
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development

--
Development mailing list
Development at qt-project.org
https://lists.qt-project.org/listinfo/development


More information about the Development mailing list