- 
    
Bug
 - 
    Resolution: Done
 - 
    
P2: Important
 - 
    6.2.0
 
- 
        
 - 
        64e931246484eb36b2b921cdec38263b21167523 (qt/qtbase/dev) 0f013d3c02fd662e77c62d9ef9272b5ed04e3772 (qt/qtbase/6.1) 7fcae4e1b51d8a9d1ba65fb1ade240ae8b204980 (qt/qtbase/6.2)
 
The build from sources fails when building qtbase of Qt 6.2.0 with MSVC 2019 v16.11.4 in c++20 mode on Windows.
When configuring the build of qtbase with:
configure -c++std c++20
The build fails in:
qtbase\src\corelib\text\qregularexpression.cpp
Line: 1188
With error: error C2101: '&' on constant
Snippet of the source code:
constexpr char16_t dummySubject = 0; const char16_t * const subjectUtf16 = [&]() { const auto subjectUtf16 = priv->subject.utf16(); if (subjectUtf16) return subjectUtf16; Q_ASSERT(subjectLength == 0); return &dummySubject; }();
Returning address of dummySubject in lambda function causes the build to fail when the dummySubject is constexpr, removing constexpr solves the issue.
Issue does not reproduce with:
 /std:c++17
The issue is not evident in minGW nor GCC either.
Please find the reproducer at:
 https://godbolt.org/z/rGra7x8aT